mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
e5ce70e175
Saving post as draft, or publishing Added HBS parser for some client tmpls Parsing paginated posts Added grunt watch for hbs parsing on updates
38 lines
No EOL
1 KiB
JavaScript
38 lines
No EOL
1 KiB
JavaScript
/*global window, document, Ghost, Backbone, $, _ */
|
|
(function () {
|
|
|
|
"use strict";
|
|
|
|
Ghost.Router = Backbone.Router.extend({
|
|
|
|
routes: {
|
|
'content/': 'blog',
|
|
'editor': 'editor',
|
|
'editor/': 'editor',
|
|
'editor/:id': 'editor'
|
|
},
|
|
|
|
blog: function () {
|
|
var posts = new Ghost.Collections.Posts();
|
|
posts.fetch({data: {status: 'all'}}).then(function () {
|
|
Ghost.currentView = new Ghost.Views.Blog({ el: '#main', collection: posts });
|
|
});
|
|
|
|
},
|
|
|
|
editor: function (id) {
|
|
var post = new Ghost.Models.Post();
|
|
post.urlRoot = Ghost.settings.apiRoot + '/posts';
|
|
if (id) {
|
|
post.id = id;
|
|
post.fetch().then(function () {
|
|
Ghost.currentView = new Ghost.Views.Editor({ el: '#main', model: post });
|
|
});
|
|
} else {
|
|
Ghost.currentView = new Ghost.Views.Editor({ el: '#main', model: post });
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
}()); |