edit changes

v1.18.x
Baris Usakli 12 years ago
parent 4b32089367
commit 6a6eeae426

@ -10,7 +10,7 @@
<div class="account-username-box">
<span class="account-username">{user.username}</span>
<span class="account-links">edit</span>
<span class="pull-right"><a href="/users/edit/{user.uid}">edit</a></span>
</div>
<br/>
@ -35,13 +35,7 @@
<span>{user.postcount}</span>
</div>
<br/>
<br/>
<label for="email">Email Address</label><input type="text" placeholder="Enter Email Address" id="email" /><br />
<button class="btn btn-primary" id="reset" type="submit">Reset Password</button>

@ -0,0 +1,26 @@
<div class="well">
<div class="alert" id="message" style="display:none">
<button type="button" class="close" data-dismiss="message">&times;</button>
<strong></strong>
<p></p>
</div>
<!-- BEGIN user -->
<label for="email">Email Address</label><input type="text" placeholder="Enter Email Address" id="email" /><br />
<button class="btn btn-primary" id="reset" type="submit">Reset Password</button>
<!-- END user -->
</div>
<script type="text/javascript">
(function() {
// ...
}());
</script>

@ -59,7 +59,7 @@
gravatar.src = data['picture']+"?s=24";
$('#user_label').attr('href','/users/'+data.uid);
$('#user_label').attr('href','/users/'+data.uid+'/'+data['username']);
user_label.innerHTML = '';
user_label.appendChild(gravatar);

@ -158,6 +158,9 @@ passport.deserializeUser(function(uid, done) {
// These functions are called via ajax once the initial page is loaded to populate templates with data
function api_method(req, res) {
switch(req.params.method) {
case 'home' :
global.modules.categories.get(function(data) {
@ -211,6 +214,7 @@ passport.deserializeUser(function(uid, done) {
});
break;
case 'users' :
get_account_fn(req, res, function(userData) {
res.send(JSON.stringify(userData));
});
@ -341,7 +345,7 @@ passport.deserializeUser(function(uid, done) {
if(data)
{
data.joindate = utils.relativeTime(data.joindate);
data.uid = requestedUserId;
callback({user:data});
}
else
@ -369,12 +373,24 @@ passport.deserializeUser(function(uid, done) {
res.send('User list');
});
app.get('/users/edit/:uid', function(req, res){
console.log("OPPA");
if(req.user && req.params.uid)
{
//res.send("editing user");
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/edit/' + req.params.uid+'");});</script>' + templates['footer']);
}
else
return res.redirect('/403');
});
app.get('/users/:uid', handleUserProfile);
app.get('/users/:uid/:username*', handleUserProfile);
function handleUserProfile(req, res) {
console.log("OPPA 1");
if(req.params.uid == 0) {
res.send("User doesn't exist!");
return;
@ -387,11 +403,13 @@ passport.deserializeUser(function(uid, done) {
else
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/' + req.params.uid +'/'+data.username + '");});</script>' + templates['footer']);
}
else
res.send("User doesn't exist!");
else {
res.send("User doesn't exist! /users/"+req.params.uid);
}
});
}
app.get('/test', function(req, res) {
global.modules.posts.get(function(data) {
res.send('<pre>' + JSON.stringify(data, null, 4) + '</pre>');

Loading…
Cancel
Save