mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:07:53 +08:00
Merge pull request #327 from tms/name-changing
Change the name displayed in the header on profile update
This commit is contained in:
commit
dfafadfe41
|
@ -53,14 +53,18 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
|
|||
}).property(),
|
||||
|
||||
save: function() {
|
||||
var _this = this;
|
||||
var _this = this, model = this.get('content');
|
||||
this.set('saving', true);
|
||||
this.set('saved', false);
|
||||
|
||||
// Cook the bio for preview
|
||||
return this.get('content').save(function(result) {
|
||||
return model.save(function(result) {
|
||||
_this.set('saving', false);
|
||||
if (result) {
|
||||
if (Discourse.currentUser.id === model.get('id')) {
|
||||
Discourse.currentUser.set('name', model.get('name'));
|
||||
}
|
||||
|
||||
_this.set('content.bio_cooked', Discourse.Utilities.cook(_this.get('content.bio_raw')));
|
||||
return _this.set('saved', true);
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{{#unless controller.showExtraInfo}}
|
||||
<div class='current-username'>
|
||||
{{#if view.currentUser}}
|
||||
<span class='username'><a {{bindAttr href="view.currentUser.path"}}>{{unbound view.currentUser.name}}</a></span>
|
||||
<span class='username'><a {{bindAttr href="view.currentUser.path"}}>{{view.currentUser.name}}</a></span>
|
||||
{{else}}
|
||||
<button {{action showLogin}} class='btn btn-primary btn-small'>{{i18n log_in}}</button>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user