mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 08:54:36 +03:00
Merge pull request #4337 from jaswilli/title
Fix up title/slug handling on posts.
This commit is contained in:
commit
49fc7c225f
@ -196,12 +196,11 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
|||||||
|
|
||||||
titleObserver: function () {
|
titleObserver: function () {
|
||||||
var debounceId,
|
var debounceId,
|
||||||
title = this.get('title'),
|
title = this.get('title');
|
||||||
slug = this.get('slug');
|
|
||||||
|
|
||||||
// generate a slug if a post is new and doesn't have a title yet or
|
// generate a slug if a post is new and doesn't have a title yet or
|
||||||
// if the title is still '(Untitled)' and the slug is unaltered.
|
// if the title is still '(Untitled)' and the slug is unaltered.
|
||||||
if ((this.get('isNew') && !title) || title === '(Untitled)' && /^untitled(-\d+){0,1}$/.test(slug)) {
|
if ((this.get('isNew') && !title) || title === '(Untitled)') {
|
||||||
debounceId = Ember.run.debounce(this, 'generateAndSetSlug', ['slug'], 700);
|
debounceId = Ember.run.debounce(this, 'generateAndSetSlug', ['slug'], 700);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,13 @@ var EditorNewRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, base
|
|||||||
|
|
||||||
setupController: function (controller, model) {
|
setupController: function (controller, model) {
|
||||||
this._super(controller, model);
|
this._super(controller, model);
|
||||||
|
|
||||||
|
var psm = this.controllerFor('post-settings-menu');
|
||||||
|
|
||||||
|
// make sure there are no titleObserver functions hanging around
|
||||||
|
// from previous posts
|
||||||
|
psm.removeObserver('titleScratch', psm, 'titleObserver');
|
||||||
|
|
||||||
controller.set('scratch', '');
|
controller.set('scratch', '');
|
||||||
controller.set('titleScratch', '');
|
controller.set('titleScratch', '');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user