This commit is contained in:
Sacha Greif 2012-09-25 08:36:15 +09:00
commit fd990ea5c1
9 changed files with 79 additions and 3 deletions

1
.meteor/.gitignore vendored
View file

@ -1 +1,2 @@
local
meteorite

View file

@ -131,6 +131,7 @@ if (Meteor.is_client) {
'users':'users',
'account':'user_edit',
'forgot_password':'forgot_password',
'user/:id': 'user_profile',
'users/:id/edit':'user_edit'
},
top: function() { this.goto('posts_top'); },
@ -170,6 +171,12 @@ if (Meteor.is_client) {
this.goto('comment_edit');
window.newCommentTimestamp=new Date();
},
user_profile: function(id){
if(typeof id !== undefined){
window.selected_user_id=id;
}
this.goto('user_profile');
},
user_edit: function(id){
if(typeof id !== undefined){
window.selected_user_id=id;
@ -216,7 +223,7 @@ getCurrentUserEmail = function(){
trackEvent = function(event, properties){
var properties= (typeof properties === 'undefined') ? {} : properties;
if(mixpanel){
if(typeof mixpanel != 'undefined'){
mixpanel.track(event, properties);
}
}

View file

@ -1163,6 +1163,17 @@ table tr td {
table thead tr td {
font-weight: bold; }
/* line 2, ../sass/modules/_user-profile.scss */
.user-profile .user-avatar {
height: 80px;
width: 80px;
display: block;
-webkit-border-radius: 80px;
-moz-border-radius: 80px;
-ms-border-radius: 80px;
-o-border-radius: 80px;
border-radius: 80px; }
/* line 1, ../sass/modules/_errors.scss */
.error {
margin-bottom: 10px;

View file

@ -0,0 +1,8 @@
.user-profile {
.user-avatar{
height:80px;
width:80px;
display:block;
@include border-radius(80px);
}
}

View file

@ -25,6 +25,7 @@
@import "modules/dialogs";
@import "modules/settings";
@import "modules/users";
@import "modules/user-profile";
@import "modules/errors";
@import "partials/mobile";

View file

@ -14,7 +14,7 @@
</a>
</div>
<div class="comment-meta">
<a class="comment-username" href="#">{{author}}</a>
<a class="comment-username" href="/user/{{user_id}}">{{author}}</a>
<span class="comment-time">{{ago}},</span>
<span class="points">{{votes}} <span class="unit">points </span>
<a href="/comments/{{_id}}" class="comment-permalink icon-link goto-comment">link</a>

View file

@ -36,7 +36,7 @@
{{/if}}
{{#if url}}<span class="post-domain">{{domain}}</span>{{/if}}
</h3>
<p class="post-meta"><span class="points">{{votes}} <span class="unit">points </span></span>by <a class="post-author" href="#">{{author}}</a> <span class="post-time">{{ago}}</span><span class="comments">, <a class="go-to-comments" href="posts/{{_id}}">{{comments}} comments</a></span>
<p class="post-meta"><span class="points">{{votes}} <span class="unit">points </span></span>by <a class="post-author" href="/user/{{user_id}}">{{author}}</a> <span class="post-time">{{ago}}</span><span class="comments">, <a class="go-to-comments" href="posts/{{_id}}">{{comments}} comments</a></span>
{{#if can_edit}}
| <a href="/posts/{{_id}}/edit" class="edit-link goto-edit">Edit</a>
{{/if}}

View file

@ -0,0 +1,28 @@
<template name="user_profile">
<div class="grid">
{{#with user}}
<div class="user-profile grid-block">
<table>
<tr>
<td colspan="2"><span class="user-avatar" style="background-image:url({{avatar_url}});"></span></td>
</tr>
<tr>
<td>Name: </td>
<td>{{username}}</td>
</tr>
<tr>
<td>Member since: </td>
<td>{{created_at_formatted}}</td>
</tr>
<tr>
<td>Bio: </td>
<td>{{profile.bio}}</td>
</tr>
</table>
{{#if is_current_user}}
<a href="/users/{{_id}}/edit">Edit profile</a>
{{/if}}
</div>
{{/with}}
</div>
</template>

View file

@ -0,0 +1,20 @@
Template.user_profile.user = function(){
if(window.selected_user_id){
return Meteor.users.findOne(window.selected_user_id);
}
}
Template.user_profile.avatar_url = function(){
return Gravatar.getGravatar(this, {
d: 'http://telescope.herokuapp.com/img/default_avatar.png',
s: 80
});
}
Template.user_profile.created_at_formatted = Template.user_item.created_at_formatted;
Template.user_profile.is_current_user = function(){
return (window.selected_user_id === current_user_id);
}