Change the name displayed in the header on profile update

This commit is contained in:
tms 2013-03-01 22:46:33 -05:00
parent 9858beb6af
commit 66a7b3162f
2 changed files with 7 additions and 3 deletions

View File

@ -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 {

View File

@ -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}}