From 9cd189e2737badb4bfb82f0a0fb065bb5308cae3 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Wed, 15 May 2013 16:44:08 -0400 Subject: [PATCH] relative time fix --- public/templates/accountedit.tpl | 13 ++++++++++--- src/routes/user.js | 10 ++++++---- src/user.js | 4 ++-- src/utils.js | 18 ++++++++---------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/public/templates/accountedit.tpl b/public/templates/accountedit.tpl index 5c75c9b4e9..5f6ca44b15 100644 --- a/public/templates/accountedit.tpl +++ b/public/templates/accountedit.tpl @@ -120,7 +120,7 @@
- Save changes + Save changes Cancel
@@ -240,9 +240,16 @@ $(document).ready(function() { $.post('/users/doedit', userData, function(data) { - - } + app.alert({ + 'alert_id': 'user_profile_updated', + type: 'success', + title: 'Profile Updated', + message: 'Your profile has been updated successfully', + timeout: 2000 + }); + } ); + return false; }); function updateImages() { diff --git a/src/routes/user.js b/src/routes/user.js index ac8fa9a1b8..caff2c837d 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -78,12 +78,13 @@ var user = require('./../user.js'), if(!req.user) return res.redirect('/403'); - if(req.user.uid != req.body.uid) + if(req.user.uid != req.body.uid) { return res.redirect('/'); + } user.updateProfile(req.user.uid, req.body); - - res.redirect('/'); + + res.send({}); }); app.post('/users/uploadpicture', function(req, res) { @@ -283,8 +284,9 @@ var user = require('./../user.js'), user.getUserData(uid, function(data) { if(data) { + console.log(data.joindate); data.joindate = utils.relativeTime(data.joindate); - + console.log(data.joindate); if(!data.birthday) data.age = ''; else diff --git a/src/user.js b/src/user.js index 4af1fc23b0..e378f40bb4 100644 --- a/src/user.js +++ b/src/user.js @@ -80,7 +80,7 @@ var config = require('../config.js'), for(var i=0,ii=fields.length; i