mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 12:28:59 +08:00
Don't display edits during user's name update
This commit is contained in:
parent
22af3fe085
commit
fd40d40eca
|
@ -14,12 +14,14 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
|
||||||
// By default we haven't saved anything
|
// By default we haven't saved anything
|
||||||
saved: false,
|
saved: false,
|
||||||
|
|
||||||
|
newNameInput: null,
|
||||||
|
|
||||||
saveDisabled: function() {
|
saveDisabled: function() {
|
||||||
if (this.get('saving')) return true;
|
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;
|
if (this.blank('email')) return true;
|
||||||
return false;
|
return false;
|
||||||
}.property('saving', 'name', 'email'),
|
}.property('saving', 'newNameInput', 'email'),
|
||||||
|
|
||||||
canEditName: function() {
|
canEditName: function() {
|
||||||
return Discourse.SiteSettings.enable_names;
|
return Discourse.SiteSettings.enable_names;
|
||||||
|
@ -57,6 +59,7 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
|
||||||
|
|
||||||
// Cook the bio for preview
|
// Cook the bio for preview
|
||||||
var model = this.get('model');
|
var model = this.get('model');
|
||||||
|
model.set('name', this.get('newNameInput'));
|
||||||
return model.save().then(function() {
|
return model.save().then(function() {
|
||||||
// model was saved
|
// model was saved
|
||||||
self.set('saving', false);
|
self.set('saving', false);
|
||||||
|
|
|
@ -11,8 +11,8 @@ Discourse.PreferencesRoute = Discourse.RestrictedUserRoute.extend({
|
||||||
return this.modelFor('user');
|
return this.modelFor('user');
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, user) {
|
||||||
controller.set('model', model);
|
controller.setProperties({ model: user, newNameInput: user.get('name') });
|
||||||
this.controllerFor('user').set('indexStream', false);
|
this.controllerFor('user').set('indexStream', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{i18n user.name.title}}</label>
|
<label class="control-label">{{i18n user.name.title}}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{textField value=name classNames="input-xxlarge"}}
|
{{textField value=newNameInput classNames="input-xxlarge"}}
|
||||||
</div>
|
</div>
|
||||||
<div class='instructions'>
|
<div class='instructions'>
|
||||||
{{i18n user.name.instructions}}
|
{{i18n user.name.instructions}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user