mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Merge pull request #3742 from rwjblue/ensure-slug-is-always-saved
This commit is contained in:
commit
96c5266e31
2 changed files with 10 additions and 7 deletions
|
@ -1,8 +1,13 @@
|
|||
import SlugGenerator from 'ghost/models/slug-generator';
|
||||
import boundOneWay from 'ghost/utils/bound-one-way';
|
||||
|
||||
var SettingsUserController = Ember.ObjectController.extend({
|
||||
|
||||
_lastSlug: null,
|
||||
|
||||
updateLastSlug: Ember.observer(function () {
|
||||
this.set('_lastSlug', this.get('user.slug'));
|
||||
}),
|
||||
|
||||
user: Ember.computed.alias('model'),
|
||||
|
||||
email: Ember.computed.readOnly('user.email'),
|
||||
|
@ -55,8 +60,6 @@ var SettingsUserController = Ember.ObjectController.extend({
|
|||
});
|
||||
}),
|
||||
|
||||
slugValue: boundOneWay('user.slug'),
|
||||
|
||||
actions: {
|
||||
changeRole: function (newRole) {
|
||||
this.set('model.role', newRole);
|
||||
|
@ -140,7 +143,7 @@ var SettingsUserController = Ember.ObjectController.extend({
|
|||
},
|
||||
|
||||
updateSlug: function (newSlug) {
|
||||
var slug = this.get('user.slug'),
|
||||
var slug = this.get('_lastSlug'),
|
||||
self = this;
|
||||
|
||||
newSlug = newSlug || slug;
|
||||
|
@ -178,7 +181,7 @@ var SettingsUserController = Ember.ObjectController.extend({
|
|||
}
|
||||
}
|
||||
|
||||
self.set('user.slug', serverSlug);
|
||||
self.set('_lastSlug', serverSlug);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
<div class="form-group">
|
||||
<label for="user-slug">Slug</label>
|
||||
{{!-- {{input value=user.slug id="user-slug" placeholder="Slug" autocorrect="off"}} --}}
|
||||
{{gh-blur-input class="user-name" id="user-slug" value=slugValue name="user" action="updateSlug" placeholder="Slug" selectOnClick="true" autocorrect="off"}}
|
||||
<p>{{gh-blog-url}}/author/{{slugValue}}</p>
|
||||
{{gh-blur-input class="user-name" id="user-slug" value=user.slug name="user" action="updateSlug" placeholder="Slug" selectOnClick="true" autocorrect="off"}}
|
||||
<p>{{gh-blog-url}}/author/{{user.slug}}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Add table
Reference in a new issue