From 21a7e3ebb2dbcd7a3be202261725f7645f0a58ad Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Thu, 12 Jun 2014 11:44:10 +0200 Subject: [PATCH] Fixes static pages when permalinks are active. fixes #2938 - Fix `page === 1` occurences - Fix ember logic --- core/client/controllers/post-settings-menu.js | 6 +++--- core/server/config/url.js | 2 +- core/server/controllers/frontend.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/client/controllers/post-settings-menu.js b/core/client/controllers/post-settings-menu.js index 64343624ce..4eff3ec6e4 100644 --- a/core/client/controllers/post-settings-menu.js +++ b/core/client/controllers/post-settings-menu.js @@ -5,16 +5,16 @@ var PostSettingsMenuController = Ember.ObjectController.extend({ var self = this; if (arguments.length > 1) { - this.set('page', val ? 1 : 0); + this.set('page', val); return this.get('model').save().then(function () { self.notifications.showSuccess('Successfully converted to ' + (val ? 'static page' : 'post')); - return !!self.get('page'); + return self.get('page'); }, this.notifications.showErrors); } - return !!this.get('page'); + return this.get('page'); }.property('page'), newSlugBinding: Ember.computed.oneWay('slug'), diff --git a/core/server/config/url.js b/core/server/config/url.js index 293b3b1ea0..5a79e5c3dc 100644 --- a/core/server/config/url.js +++ b/core/server/config/url.js @@ -65,7 +65,7 @@ function urlPathForPost(post, permalinks) { id: function () { return post.id; } }; - if (post.page === 1) { + if (post.page) { output += '/:slug/'; } else { output += permalinks.value; diff --git a/core/server/controllers/frontend.js b/core/server/controllers/frontend.js index a39b001038..cc9cf0a92e 100644 --- a/core/server/controllers/frontend.js +++ b/core/server/controllers/frontend.js @@ -240,7 +240,7 @@ frontendControllers = { // then the post must be a static post. // If it is not then we must return. if (usingStaticPermalink) { - if (post.page === 1) { + if (post.page) { return render(); }