Removed dated permalinks setting

no issue
- permalink config is now handled through `routes.yaml`
This commit is contained in:
Kevin Ansfield 2018-08-08 17:00:46 +01:00
parent e4f7a0dbb2
commit 7ee7c3a9f8
6 changed files with 7 additions and 112 deletions

View File

@ -35,21 +35,6 @@ export default Controller.extend({
this.iconExtensions = ICON_EXTENSIONS;
},
isDatedPermalinks: computed('settings.permalinks', {
set(key, value) {
this.set('settings.permalinks', value ? '/:year/:month/:day/:slug/' : '/:slug/');
let slugForm = this.get('settings.permalinks');
return slugForm !== '/:slug/';
},
get() {
let slugForm = this.get('settings.permalinks');
return slugForm !== '/:slug/';
}
}),
privateRSSUrl: computed('config.blogUrl', 'settings.publicHash', function () {
let blogUrl = this.get('config.blogUrl');
let publicHash = this.get('settings.publicHash');

View File

@ -13,7 +13,6 @@ export default Model.extend(ValidationEngine, {
icon: attr('string'),
defaultLocale: attr('string'),
forceI18n: attr('boolean'),
permalinks: attr('string'),
activeTimezone: attr('string', {defaultValue: 'Etc/UTC'}),
ghostHead: attr('string'),
ghostFoot: attr('string'),

View File

@ -232,26 +232,6 @@
</div>
<div class="gh-setting-header">Advanced settings</div>
<div class="gh-setting">
<div class="gh-setting-content">
<div class="gh-setting-title">Use dated permalinks</div>
<div class="gh-setting-desc">Include the date in your post URLs, e.g. <strong>blogurl.com/2017/01/01/post-title/</strong></div>
</div>
<div class="gh-setting-action">
<div class="for-checkbox">
<label class="checkbox" for="settings-dated-permalinks">
<input
type="checkbox"
checked={{isDatedPermalinks}}
id="settings-dated-permalinks"
onclick={{action (mut isDatedPermalinks) value="target.checked"}}
data-test-dated-permalinks-checkbox
>
<span class="input-toggle-component"></span>
</label>
</div>
</div>
</div>
<div class="gh-setting">
<div class="gh-setting-content">
<div class="gh-setting-title">Make this site private</div>

View File

@ -60,16 +60,6 @@ export default [
updated_at: '2015-10-27T17:39:58.280Z',
updated_by: 1
},
{
id: 9,
key: 'permalinks',
value: '/:slug/',
type: 'blog',
created_at: '2014-01-14T12:01:51.000Z',
created_by: 1,
updated_at: '2015-10-27T17:39:58.282Z',
updated_by: 1
},
{
id: 10,
created_at: '2015-09-11T09:44:30.809Z',

View File

@ -83,11 +83,6 @@ describe('Acceptance: Settings - General', function () {
'save button text'
).to.equal('Save settings');
expect(
find('[data-test-dated-permalinks-checkbox]').prop('checked'),
'date permalinks checkbox'
).to.be.false;
await click('[data-test-toggle-pub-info]');
await fillIn('[data-test-title-input]', 'New Blog Title');
await click('[data-test-save-button]');
@ -474,18 +469,18 @@ describe('Acceptance: Settings - General', function () {
await visit('/settings/general');
expect(
find('[data-test-dated-permalinks-checkbox]').prop('checked'),
'date permalinks checkbox'
find('[data-test-private-checkbox]').prop('checked'),
'private blog checkbox'
).to.be.false;
await click('[data-test-toggle-pub-info]');
await fillIn('[data-test-title-input]', 'New Blog Title');
await click('[data-test-dated-permalinks-checkbox]');
await click('[data-test-private-checkbox]');
expect(
find('[data-test-dated-permalinks-checkbox]').prop('checked'),
'dated permalink checkbox'
find('[data-test-private-checkbox]').prop('checked'),
'private blog checkbox'
).to.be.true;
await visit('/settings/team');
@ -503,8 +498,8 @@ describe('Acceptance: Settings - General', function () {
// settings were not saved
expect(
find('[data-test-dated-permalinks-checkbox]').prop('checked'),
'date permalinks checkbox'
find('[data-test-private-checkbox]').prop('checked'),
'private blog checkbox'
).to.be.false;
expect(

View File

@ -1,54 +0,0 @@
import EmberObject from '@ember/object';
import {describe, it} from 'mocha';
import {run} from '@ember/runloop';
import {setupTest} from 'ember-mocha';
describe('Unit: Controller: settings/general', function () {
setupTest('controller:settings/general', {
needs: [
'service:config',
'service:ghostPaths',
'service:notifications',
'service:session',
'service:settings'
]
});
it('isDatedPermalinks should be correct', function () {
let controller = this.subject({
settings: EmberObject.create({
permalinks: '/:year/:month/:day/:slug/'
})
});
expect(controller.get('isDatedPermalinks')).to.be.ok;
run(function () {
controller.set('settings.permalinks', '/:slug/');
expect(controller.get('isDatedPermalinks')).to.not.be.ok;
});
});
it('setting isDatedPermalinks should switch between dated and slug', function () {
let controller = this.subject({
settings: EmberObject.create({
permalinks: '/:year/:month/:day/:slug/'
})
});
run(function () {
controller.set('isDatedPermalinks', false);
expect(controller.get('isDatedPermalinks')).to.not.be.ok;
expect(controller.get('settings.permalinks')).to.equal('/:slug/');
});
run(function () {
controller.set('isDatedPermalinks', true);
expect(controller.get('isDatedPermalinks')).to.be.ok;
expect(controller.get('settings.permalinks')).to.equal('/:year/:month/:day/:slug/');
});
});
});