Merge pull request #1533 from jgillich/permalinks

Add Customisable Permalinks
This commit is contained in:
Hannah Wolfe 2013-11-23 14:29:02 -08:00
commit 5ec7a95d54
3 changed files with 18 additions and 5 deletions

View File

@ -4,7 +4,11 @@
//id:0 is used to issue PUT requests
Ghost.Models.Settings = Ghost.ProgressModel.extend({
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
id: '0'
id: '0',
parse: function (resp) {
resp.permalinks = resp.permalinks === "/:slug/" ? "" : "1";
return resp;
}
});
}());
}());

View File

@ -54,6 +54,13 @@
<p>How many posts should be displayed on each page</p>
</div>
<div class="form-group">
<label for="permalinks">Dated Permalinks</label>
<input id="permalinks" name="general[permalinks]" type="checkbox" value="1" {{#if permalinks}}checked{{/if}}>
<label class="checkbox" for="permalinks"></label>
<p>Include date in your post's links</p>
</div>
<div class="form-group">
<label for="activeTheme">Theme</label>
<select id="activeTheme" name="general[activeTheme]">
@ -66,4 +73,4 @@
</fieldset>
</form>
</section>
</section>

View File

@ -157,7 +157,8 @@
title = this.$('#blog-title').val(),
description = this.$('#blog-description').val(),
email = this.$('#email-address').val(),
postsPerPage = this.$('#postsPerPage').val();
postsPerPage = this.$('#postsPerPage').val(),
permalinks = this.$('#permalinks').is(':checked') ? "/:year/:month/:day/:slug/" : "/:slug/";
Ghost.Validate._errors = [];
Ghost.Validate
@ -185,7 +186,8 @@
description: description,
email: email,
postsPerPage: postsPerPage,
activeTheme: this.$('#activeTheme').val()
activeTheme: this.$('#activeTheme').val(),
permalinks: permalinks
}, {
success: this.saveSuccess,
error: this.saveError