mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
added profile views to users, little cleanup to use app.addCommasToNumbers
This commit is contained in:
@@ -5,11 +5,7 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var rep = $('#reputation');
|
app.addCommasToNumbers();
|
||||||
rep.html(app.addCommas(rep.html()));
|
|
||||||
|
|
||||||
var postcount = $('#postcount');
|
|
||||||
postcount.html(app.addCommas(postcount.html()));
|
|
||||||
|
|
||||||
var followBtn = $('#follow-btn');
|
var followBtn = $('#follow-btn');
|
||||||
var unfollowBtn = $('#unfollow-btn');
|
var unfollowBtn = $('#unfollow-btn');
|
||||||
|
|||||||
@@ -10,13 +10,7 @@
|
|||||||
$('#no-followers-notice').show();
|
$('#no-followers-notice').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.reputation').each(function(index, element) {
|
app.addCommasToNumbers();
|
||||||
$(element).html(app.addCommas($(element).html()));
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.postcount').each(function(index, element) {
|
|
||||||
$(element).html(app.addCommas($(element).html()));
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.reputation').each(function(index, element) {
|
app.addCommasToNumbers();
|
||||||
$(element).html(app.addCommas($(element).html()));
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.postcount').each(function(index, element) {
|
|
||||||
$(element).html(app.addCommas($(element).html()));
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
parts = url.split('/'),
|
parts = url.split('/'),
|
||||||
active = parts[parts.length-1];
|
active = parts[parts.length-1];
|
||||||
|
|
||||||
|
app.addCommasToNumbers();
|
||||||
|
|
||||||
jQuery('.nav-pills li').removeClass('active');
|
jQuery('.nav-pills li').removeClass('active');
|
||||||
jQuery('.nav-pills li a').each(function() {
|
jQuery('.nav-pills li a').each(function() {
|
||||||
if (this.getAttribute('href').match(active)) {
|
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) {
|
function onUsersLoaded(users) {
|
||||||
var html = templates.prepare(templates['users'].blocks['users']).parse({ users: users });
|
var html = templates.prepare(templates['users'].blocks['users']).parse({ users: users });
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4>profile</h4>
|
|
||||||
<div class="inline-block">
|
<div class="inline-block">
|
||||||
<div class="account-bio-block">
|
<div class="account-bio-block">
|
||||||
<span class="account-bio-label">email</span><i class="icon-eye-close {emailClass}" title="Email hidden"></i>
|
<span class="account-bio-label">email</span><i class="icon-eye-close {emailClass}" title="Email hidden"></i>
|
||||||
@@ -61,20 +60,24 @@
|
|||||||
<span>{joindate}</span>
|
<span>{joindate}</span>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<span class="account-bio-label">profile views</span>
|
||||||
|
<span class="formatted-number">{profileviews}</span>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<span class="account-bio-label">reputation</span>
|
<span class="account-bio-label">reputation</span>
|
||||||
<span id='reputation'>{reputation}</span>
|
<span class="formatted-number">{reputation}</span>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<span class="account-bio-label">posts</span>
|
<span class="account-bio-label">posts</span>
|
||||||
<span id='postcount'>{postcount}</span>
|
<span class="formatted-number">{postcount}</span>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<span class="account-bio-label">followers</span>
|
<span class="account-bio-label">followers</span>
|
||||||
<span>{followerCount}</span>
|
<span class="formatted-number">{followerCount}</span>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<span class="account-bio-label">following</span>
|
<span class="account-bio-label">following</span>
|
||||||
<span>{followingCount}</span>
|
<span class="formatted-number">{followingCount}</span>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
@@ -87,7 +90,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="span6 user-recent-posts">
|
<div class="span6 user-recent-posts">
|
||||||
<h4>recent posts </h4>
|
|
||||||
<!-- BEGIN posts -->
|
<!-- BEGIN posts -->
|
||||||
<div class="topic-row img-polaroid clearfix" topic-url="topic/{posts.tid}/#{posts.pid}">
|
<div class="topic-row img-polaroid clearfix" topic-url="topic/{posts.tid}/#{posts.pid}">
|
||||||
<span>{posts.content}</span>
|
<span>{posts.content}</span>
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
<a href="/users/{followers.userslug}">{followers.username}</a>
|
<a href="/users/{followers.userslug}">{followers.username}</a>
|
||||||
<br/>
|
<br/>
|
||||||
<div title="reputation">
|
<div title="reputation">
|
||||||
<span class='reputation'>{followers.reputation}</span>
|
<span class='formatted-number'>{followers.reputation}</span>
|
||||||
<i class='icon-star'></i>
|
<i class='icon-star'></i>
|
||||||
</div>
|
</div>
|
||||||
<div title="post count">
|
<div title="post count">
|
||||||
<span class='postcount'>{followers.postcount}</span>
|
<span class='formatted-number'>{followers.postcount}</span>
|
||||||
<i class='icon-pencil'></i>
|
<i class='icon-pencil'></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,11 +26,11 @@
|
|||||||
<a href="/users/{following.userslug}">{following.username}</a>
|
<a href="/users/{following.userslug}">{following.username}</a>
|
||||||
<br/>
|
<br/>
|
||||||
<div title="reputation">
|
<div title="reputation">
|
||||||
<span class='reputation'>{following.reputation}</span>
|
<span class='formatted-number'>{following.reputation}</span>
|
||||||
<i class='icon-star'></i>
|
<i class='icon-star'></i>
|
||||||
</div>
|
</div>
|
||||||
<div title="post count">
|
<div title="post count">
|
||||||
<span class='postcount'>{following.postcount}</span>
|
<span class='formatted-number'>{following.postcount}</span>
|
||||||
<i class='icon-pencil'></i>
|
<i class='icon-pencil'></i>
|
||||||
</div>
|
</div>
|
||||||
<a id="unfollow-btn" href="#" class="btn unfollow-btn" followingUid="{following.uid}" data-username="{following.username}">Unfollow</a>
|
<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>
|
<a href="/users/{users.userslug}">{users.username}</a>
|
||||||
<br/>
|
<br/>
|
||||||
<div title="reputation">
|
<div title="reputation">
|
||||||
<span class='reputation'>{users.reputation}</span>
|
<span class='formatted-number'>{users.reputation}</span>
|
||||||
<i class='icon-star'></i>
|
<i class='icon-star'></i>
|
||||||
</div>
|
</div>
|
||||||
<div title="post count">
|
<div title="post count">
|
||||||
<span class='postcount'>{users.postcount}</span>
|
<span class='formatted-number'>{users.postcount}</span>
|
||||||
<i class='icon-pencil'></i>
|
<i class='icon-pencil'></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -303,6 +303,10 @@ var user = require('./../user.js'),
|
|||||||
userData.posts = posts.filter(function(p) {return p.deleted !== "1";});
|
userData.posts = posts.filter(function(p) {return p.deleted !== "1";});
|
||||||
userData.isFollowing = isFollowing;
|
userData.isFollowing = isFollowing;
|
||||||
userData.signature = postTools.markdownToHTML(userData.signature, true);
|
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);
|
res.json(userData);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ var utils = require('./../public/src/utils.js'),
|
|||||||
'picture': gravatar,
|
'picture': gravatar,
|
||||||
'gravatarpicture' : gravatar,
|
'gravatarpicture' : gravatar,
|
||||||
'uploadedpicture': '',
|
'uploadedpicture': '',
|
||||||
|
'profileviews': 0,
|
||||||
'reputation': 0,
|
'reputation': 0,
|
||||||
'postcount': 0,
|
'postcount': 0,
|
||||||
'lastposttime': 0,
|
'lastposttime': 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user