Merge pull request #1954 from verg/unbind_user_name

Don't display edits during user's name update
This commit is contained in:
Sam 2014-02-17 10:38:43 +11:00
commit 49efb055f2
3 changed files with 8 additions and 5 deletions

View File

@ -14,12 +14,14 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
// By default we haven't saved anything
saved: false,
newNameInput: null,
saveDisabled: function() {
if (this.get('saving')) return true;
if (Discourse.SiteSettings.enable_names && this.blank('name')) return true;
if (Discourse.SiteSettings.enable_names && this.blank('newNameInput')) return true;
if (this.blank('email')) return true;
return false;
}.property('saving', 'name', 'email'),
}.property('saving', 'newNameInput', 'email'),
cannotDeleteAccount: Em.computed.not('can_delete_account'),
deleteDisabled: Em.computed.or('saving', 'deleting', 'cannotDeleteAccount'),
@ -60,6 +62,7 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
// Cook the bio for preview
var model = this.get('model');
model.set('name', this.get('newNameInput'));
return model.save().then(function() {
// model was saved
self.set('saving', false);

View File

@ -11,8 +11,8 @@ Discourse.PreferencesRoute = Discourse.RestrictedUserRoute.extend({
return this.modelFor('user');
},
setupController: function(controller, model) {
controller.set('model', model);
setupController: function(controller, user) {
controller.setProperties({ model: user, newNameInput: user.get('name') });
this.controllerFor('user').set('indexStream', false);
},

View File

@ -19,7 +19,7 @@
<div class="control-group">
<label class="control-label">{{i18n user.name.title}}</label>
<div class="controls">
{{textField value=name classNames="input-xxlarge"}}
{{textField value=newNameInput classNames="input-xxlarge"}}
</div>
<div class='instructions'>
{{i18n user.name.instructions}}