Adds slashes to urls

ref issue #448

- adds slashes to urls, templates and tests

TODO

Add function to add slash to urls automatically
This commit is contained in:
cobbspur 2013-09-15 12:13:06 +01:00 committed by Hannah Wolfe
parent 1870d00eef
commit bf33d4619d
11 changed files with 24 additions and 17 deletions

View File

@ -50,7 +50,7 @@
nextPage: 0,
prevPage: 0,
url: Ghost.settings.apiRoot + '/posts',
url: Ghost.settings.apiRoot + '/posts/',
model: Ghost.Models.Post,
parse: function (resp) {

View File

@ -3,7 +3,7 @@
"use strict";
//id:0 is used to issue PUT requests
Ghost.Models.Settings = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/settings?type=blog,theme',
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
id: "0"
});

View File

@ -3,6 +3,6 @@
"use strict";
Ghost.Collections.Tags = Backbone.Collection.extend({
url: Ghost.settings.apiRoot + '/tags'
url: Ghost.settings.apiRoot + '/tags/'
});
}());

View File

@ -0,0 +1,9 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
Ghost.Models.Themes = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/themes'
});
}());

View File

@ -3,11 +3,11 @@
"use strict";
Ghost.Models.User = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/users/me'
url: Ghost.settings.apiRoot + '/users/me/'
});
// Ghost.Collections.Users = Backbone.Collection.extend({
// url: Ghost.settings.apiRoot + '/users'
// url: Ghost.settings.apiRoot + '/users/'
// });
}());

View File

@ -36,7 +36,7 @@
});
Ghost.Collections.Widgets = Backbone.Collection.extend({
// url: Ghost.settings.apiRoot + '/widgets', // What will this be?
// url: Ghost.settings.apiRoot + '/widgets/', // What will this be?
model: Ghost.Models.Widget
});

View File

@ -7,10 +7,8 @@
routes: {
'' : 'blog',
'content/' : 'blog',
'settings/' : 'settings',
'settings(/:pane)' : 'settings',
'editor/' : 'editor',
'editor(/:id)' : 'editor',
'settings(/:pane)/' : 'settings',
'editor(/:id)/' : 'editor',
'debug/' : 'debug',
'register/' : 'register',
'signup/' : 'signup',
@ -40,7 +38,7 @@
settings: function (pane) {
if (!pane) {
// Redirect to settings/general if no pane supplied
this.navigate('/settings/general', {
this.navigate('/settings/general/', {
trigger: true,
replace: true
});

View File

@ -26,7 +26,7 @@
{{#if logo}}
<a class="js-modal-logo" href="#"><img id="blog-logo" src="{{logo}}" alt="logo"></a>
{{else}}
<a class="button-add js-modal-logo" href="#">Upload Image</a>
<a class="button-add js-modal-logo" >Upload Image</a>
{{/if}}
<p>Display a sexy logo for your publication</p>
</div>
@ -36,7 +36,7 @@
{{#if cover}}
<a class="js-modal-cover" href="#"><img id="blog-cover" src="{{cover}}" alt="cover photo"></a>
{{else}}
<a class="button-add js-modal-cover" href="#">Upload Image</a>
<a class="button-add js-modal-cover">Upload Image</a>
{{/if}}
<p>Display a cover image on your site</p>
</div>

View File

@ -186,7 +186,7 @@
e.preventDefault();
// for now this will disable "open in new tab", but when we have a Router implemented
// it can go back to being a normal link to '#/ghost/editor/X'
window.location = '/ghost/editor/' + this.model.get('id');
window.location = '/ghost/editor/' + this.model.get('id') + '/';
},
templateName: "preview",

View File

@ -94,7 +94,7 @@
});
this.listenTo(this.model, 'change:status', this.render);
this.model.on('change:id', function (m) {
Backbone.history.navigate('/editor/' + m.id);
Backbone.history.navigate('/editor/' + m.id + '/');
});
},
@ -660,4 +660,4 @@
});
};
}());
}());

View File

@ -59,7 +59,7 @@
var self = this,
model;
Ghost.router.navigate('/settings/' + id);
Ghost.router.navigate('/settings/' + id + '/');
Ghost.trigger('urlchange');
if (this.pane && id === this.pane.el.id) {
return;