fixed users page so that all reps and post counts are comma delimited, some image upload fixes

v1.18.x
Baris Soner Usakli 12 years ago
parent e476e27807
commit 5785b16ae9

@ -140,7 +140,12 @@ $(document).ready(function() {
$('#uploadForm').submit(function() {
status('uploading the file ...');
if(!$('#userPhotoInput').val()) {
error('select an image to upload!');
return false;
}
$(this).ajaxSubmit({
error: function(xhr) {
@ -248,15 +253,19 @@ $(document).ready(function() {
var gravatarPicture = $('#user-data-gravatarpicture').html();
var uploadedPicture = $('#user-data-uploadedpicture').html();
if(gravatarPicture)
if(gravatarPicture) {
$('#user-gravatar-picture').attr('src', gravatarPicture);
$('#gravatar-box').show();
}
else
$('#user-gravatar-picture').addClass('hide');
$('#gravatar-box').hide();
if(uploadedPicture)
if(uploadedPicture) {
$('#user-uploaded-picture').attr('src', uploadedPicture);
$('#uploaded-box').show();
}
else
$('#user-uploaded-picture').addClass('hide');
$('#uploaded-box').hide();
if(currentPicture == gravatarPicture)

@ -11,11 +11,11 @@
<a href="/users/{users.username}">{users.username}</a>
<br/>
<div title="reputation">
<span id='reputation'>{users.reputation}</span>
<span class='reputation'>{users.reputation}</span>
<i class='icon-star'></i>
</div>
<div title="post count">
<span id='postcount'>{users.postcount}</span>
<span class='postcount'>{users.postcount}</span>
<i class='icon-pencil'></i>
</div>
@ -32,11 +32,14 @@
}
$(document).ready(function() {
var rep = $('#reputation');
rep.html(addCommas(rep.html()));
var postcount = $('#postcount');
postcount.html(addCommas(postcount.html()));
$('.reputation').each(function(index, element) {
$(element).html(addCommas($(element).html()));
})
$('.postcount').each(function(index, element) {
$(element).html(addCommas($(element).html()));
})
});

@ -233,6 +233,14 @@ var express = require('express'),
});
function uploadUserPicture(uid, filename, tempPath, res) {
if(!filename){
res.send({
error: 'Error uploading file! Error : Invalid file name!'
});
return;
}
var uploadPath = config['upload_path'] + uid + '-' + filename;
fs.rename(

Loading…
Cancel
Save