decimal places for rep and post count

v1.18.x
Baris Usakli 12 years ago
parent 4cb59c5aa9
commit d308242d2d

@ -28,11 +28,11 @@
<br/> <br/>
<span class="account-bio-label">reputation</span> <span class="account-bio-label">reputation</span>
<span>{user.reputation}</span> <span id='reputation'>{user.reputation}</span>
<br/> <br/>
<span class="account-bio-label">posts</span> <span class="account-bio-label">posts</span>
<span>{user.postcount}</span> <span id='postcount'>{user.postcount}</span>
</div> </div>
@ -47,6 +47,20 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
// ...
function addCommas(text) {
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
}
$(document).ready(function() {
var rep = $('#reputation');
rep.html(addCommas(rep.html()));
var postcount = $('#postcount');
postcount.html(addCommas(postcount.html()));
});
}()); }());
</script> </script>

@ -11,15 +11,35 @@
<a href="/users/{users.username}">{users.username}</a> <a href="/users/{users.username}">{users.username}</a>
<br/> <br/>
<div title="reputation"> <div title="reputation">
<span>{users.reputation}</span> <span id='reputation'>{users.reputation}</span>
<i class='icon-star'></i> <i class='icon-star'></i>
</div> </div>
<div title="post count"> <div title="post count">
<span>{users.postcount}</span> <span id='postcount'>{users.postcount}</span>
<i class='icon-pencil'></i> <i class='icon-pencil'></i>
</div> </div>
</div> </div>
<!-- END users --> <!-- END users -->
</div> </div>
<script>
(function() {
function addCommas(text) {
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
}
$(document).ready(function() {
var rep = $('#reputation');
rep.html(addCommas(rep.html()));
var postcount = $('#postcount');
postcount.html(addCommas(postcount.html()));
});
}());
</script>

@ -436,7 +436,8 @@ passport.deserializeUser(function(uid, done) {
user.getUserData(uid, function(data) { user.getUserData(uid, function(data) {
if(data) { if(data) {
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/'+data.username + '");});</script>' + templates['footer']); //res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/'+data.username + '");});</script>' + templates['footer']);
res.send(templates['header'] + create_route('users/'+data.username,'users') + templates['footer']);
} }
else { else {
res.send("User doesn't exist! /users/"+req.params.username); res.send("User doesn't exist! /users/"+req.params.username);

Loading…
Cancel
Save