Saving settings works ok
This commit is contained in:
@@ -88,5 +88,5 @@ $(function(){
|
||||
Ajax.loadArtistData($(this).html());
|
||||
return false;
|
||||
});
|
||||
$(window).bind('hashchange', Ajax.detectPage);
|
||||
//$(window).bind('hashchange', Ajax.detectPage);
|
||||
})
|
||||
@@ -91,5 +91,6 @@ var Pages = {
|
||||
$('#data-container .inner').html(data);
|
||||
yaCounter7596904.hit(Ajax.getAnchor(), 'Settings', Ajax.referer);
|
||||
Ajax.setTitle('Settings');
|
||||
$('.settings-container .tabs .tab').first().trigger('click');
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,42 @@
|
||||
var Settings = {
|
||||
|
||||
getAccountInfo: function(callback) {
|
||||
Session.query('/user/update', {}, callback);
|
||||
},
|
||||
|
||||
saveAccountInfo: function(params, callback) {
|
||||
Session.query('/user/update', params, callback);
|
||||
},
|
||||
|
||||
loadFormData: function(form) {
|
||||
if (form == 'account') {
|
||||
this.getAccountInfo(function(data){
|
||||
$('.settings-container .form input[name$="username"]').val(data.username);
|
||||
$('.settings-container .form input[name$="email"]').val(data.email);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('.settings').live('click', function() {
|
||||
Ajax.loadSettingsPage();
|
||||
})
|
||||
});
|
||||
|
||||
$('.settings-container .tabs .tab').live('click', function(){
|
||||
if (!$(this).hasClass('active')) {
|
||||
$('.settings-container .tabs .tab').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.form-container').html($('.forms .'+ $(this).attr('data-fieldset')).html());
|
||||
Settings.loadFormData($(this).attr('data-fieldset'));
|
||||
}
|
||||
});
|
||||
|
||||
$('.settings-container .form input').live('blur', function(){
|
||||
params = {
|
||||
'username': $('.settings-container .form input[name$="username"]').first().val(),
|
||||
'email': $('.settings-container .form input[name$="email"]').first().val(),
|
||||
};
|
||||
Settings.saveAccountInfo(params, function(){
|
||||
console.log('saved');
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user