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

@ -11,11 +11,11 @@
<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 id='reputation'>{users.reputation}</span> <span class='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 id='postcount'>{users.postcount}</span> <span class='postcount'>{users.postcount}</span>
<i class='icon-pencil'></i> <i class='icon-pencil'></i>
</div> </div>
@ -32,11 +32,14 @@
} }
$(document).ready(function() { $(document).ready(function() {
var rep = $('#reputation');
rep.html(addCommas(rep.html()));
var postcount = $('#postcount'); $('.reputation').each(function(index, element) {
postcount.html(addCommas(postcount.html())); $(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) { 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; var uploadPath = config['upload_path'] + uid + '-' + filename;
fs.rename( fs.rename(

Loading…
Cancel
Save