added profile views to users, little cleanup to use app.addCommasToNumbers

v1.18.x
Baris Soner Usakli 12 years ago
parent ff805a704d
commit 6690f49c4e

@ -5,11 +5,7 @@
$(document).ready(function() {
var rep = $('#reputation');
rep.html(app.addCommas(rep.html()));
var postcount = $('#postcount');
postcount.html(app.addCommas(postcount.html()));
app.addCommasToNumbers();
var followBtn = $('#follow-btn');
var unfollowBtn = $('#unfollow-btn');

@ -10,13 +10,7 @@
$('#no-followers-notice').show();
}
$('.reputation').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
$('.postcount').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
app.addCommasToNumbers();
});

@ -32,14 +32,7 @@
});
}
$('.reputation').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
$('.postcount').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
app.addCommasToNumbers();
});

@ -8,6 +8,8 @@
parts = url.split('/'),
active = parts[parts.length-1];
app.addCommasToNumbers();
jQuery('.nav-pills li').removeClass('active');
jQuery('.nav-pills li a').each(function() {
if (this.getAttribute('href').match(active)) {
@ -67,13 +69,7 @@
});
$('.reputation').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
$('.postcount').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
function onUsersLoaded(users) {
var html = templates.prepare(templates['users'].blocks['users']).parse({ users: users });

@ -34,7 +34,6 @@
</div>
<div class="span4">
<h4>profile</h4>
<div class="inline-block">
<div class="account-bio-block">
<span class="account-bio-label">email</span><i class="icon-eye-close {emailClass}" title="Email hidden"></i>
@ -61,20 +60,24 @@
<span>{joindate}</span>
<br/>
<span class="account-bio-label">profile views</span>
<span class="formatted-number">{profileviews}</span>
<br/>
<span class="account-bio-label">reputation</span>
<span id='reputation'>{reputation}</span>
<span class="formatted-number">{reputation}</span>
<br/>
<span class="account-bio-label">posts</span>
<span id='postcount'>{postcount}</span>
<span class="formatted-number">{postcount}</span>
<br/>
<span class="account-bio-label">followers</span>
<span>{followerCount}</span>
<span class="formatted-number">{followerCount}</span>
<br/>
<span class="account-bio-label">following</span>
<span>{followingCount}</span>
<span class="formatted-number">{followingCount}</span>
<br/>
<hr/>
@ -87,7 +90,6 @@
</div>
<div class="span6 user-recent-posts">
<h4>recent posts </h4>
<!-- BEGIN posts -->
<div class="topic-row img-polaroid clearfix" topic-url="topic/{posts.tid}/#{posts.pid}">
<span>{posts.content}</span>

@ -24,11 +24,11 @@
<a href="/users/{followers.userslug}">{followers.username}</a>
<br/>
<div title="reputation">
<span class='reputation'>{followers.reputation}</span>
<span class='formatted-number'>{followers.reputation}</span>
<i class='icon-star'></i>
</div>
<div title="post count">
<span class='postcount'>{followers.postcount}</span>
<span class='formatted-number'>{followers.postcount}</span>
<i class='icon-pencil'></i>
</div>
</div>

@ -26,11 +26,11 @@
<a href="/users/{following.userslug}">{following.username}</a>
<br/>
<div title="reputation">
<span class='reputation'>{following.reputation}</span>
<span class='formatted-number'>{following.reputation}</span>
<i class='icon-star'></i>
</div>
<div title="post count">
<span class='postcount'>{following.postcount}</span>
<span class='formatted-number'>{following.postcount}</span>
<i class='icon-pencil'></i>
</div>
<a id="unfollow-btn" href="#" class="btn unfollow-btn" followingUid="{following.uid}" data-username="{following.username}">Unfollow</a>

@ -24,11 +24,11 @@
<a href="/users/{users.userslug}">{users.username}</a>
<br/>
<div title="reputation">
<span class='reputation'>{users.reputation}</span>
<span class='formatted-number'>{users.reputation}</span>
<i class='icon-star'></i>
</div>
<div title="post count">
<span class='postcount'>{users.postcount}</span>
<span class='formatted-number'>{users.postcount}</span>
<i class='icon-pencil'></i>
</div>
</div>

@ -69,7 +69,7 @@ var user = require('./../user.js'),
app.build_header({ req: req, res: res }, function(err, header) {
res.send(header + app.create_route('users/' + req.params.userslug, 'account') + templates['footer']);
});
});
});
});
@ -303,6 +303,10 @@ var user = require('./../user.js'),
userData.posts = posts.filter(function(p) {return p.deleted !== "1";});
userData.isFollowing = isFollowing;
userData.signature = postTools.markdownToHTML(userData.signature, true);
if(!userData.profileviews)
userData.profileviews = 1;
if(callerUID !== userData.uid)
user.incrementUserFieldBy(userData.uid, 'profileviews', 1);
res.json(userData);
});
});

@ -63,6 +63,7 @@ var utils = require('./../public/src/utils.js'),
'picture': gravatar,
'gravatarpicture' : gravatar,
'uploadedpicture': '',
'profileviews': 0,
'reputation': 0,
'postcount': 0,
'lastposttime': 0,

Loading…
Cancel
Save