2014-02-27 08:45:45 +04:00
|
|
|
/*global Ember */
|
2014-11-25 23:56:08 +03:00
|
|
|
/* jshint unused: false */
|
2014-06-24 04:38:30 +04:00
|
|
|
import ghostPaths from 'ghost/utils/ghost-paths';
|
2014-11-25 23:56:08 +03:00
|
|
|
import documentTitle from 'ghost/utils/document-title';
|
2014-02-26 08:58:00 +04:00
|
|
|
|
2014-02-27 08:45:45 +04:00
|
|
|
// ensure we don't share routes between all Router instances
|
|
|
|
var Router = Ember.Router.extend();
|
|
|
|
|
2014-11-25 23:56:08 +03:00
|
|
|
documentTitle();
|
|
|
|
|
2014-03-02 18:30:35 +04:00
|
|
|
Router.reopen({
|
2014-05-14 05:52:31 +04:00
|
|
|
location: 'trailing-history', // use HTML5 History API instead of hash-tag based URLs
|
2014-08-10 21:10:29 +04:00
|
|
|
rootURL: ghostPaths().adminRoot, // admin interface lives under sub-directory /ghost
|
2014-06-24 14:00:28 +04:00
|
|
|
|
|
|
|
clearNotifications: function () {
|
2014-06-30 01:45:03 +04:00
|
|
|
this.notifications.closePassive();
|
2014-06-24 14:00:28 +04:00
|
|
|
this.notifications.displayDelayed();
|
|
|
|
}.on('didTransition')
|
2014-03-02 18:30:35 +04:00
|
|
|
});
|
|
|
|
|
2014-02-27 08:45:45 +04:00
|
|
|
Router.map(function () {
|
2014-06-25 16:12:48 +04:00
|
|
|
this.route('setup');
|
2014-03-10 07:44:08 +04:00
|
|
|
this.route('signin');
|
2014-06-01 23:30:50 +04:00
|
|
|
this.route('signout');
|
2014-10-25 01:09:50 +04:00
|
|
|
this.route('signup', {path: '/signup/:token'});
|
2014-03-10 07:44:08 +04:00
|
|
|
this.route('forgotten');
|
2014-10-25 01:09:50 +04:00
|
|
|
this.route('reset', {path: '/reset/:token'});
|
|
|
|
|
|
|
|
this.resource('posts', {path: '/'}, function () {
|
|
|
|
this.route('post', {path: ':post_id'});
|
2014-03-02 18:30:35 +04:00
|
|
|
});
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-06-10 08:44:29 +04:00
|
|
|
this.resource('editor', function () {
|
2014-10-25 01:09:50 +04:00
|
|
|
this.route('new', {path: ''});
|
|
|
|
this.route('edit', {path: ':post_id'});
|
2014-06-10 08:44:29 +04:00
|
|
|
});
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-03-10 07:44:08 +04:00
|
|
|
this.resource('settings', function () {
|
|
|
|
this.route('general');
|
2014-10-25 01:09:50 +04:00
|
|
|
|
|
|
|
this.resource('settings.users', {path: '/users'}, function () {
|
|
|
|
this.route('user', {path: '/:slug'});
|
2014-07-02 07:44:39 +04:00
|
|
|
});
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-08-02 19:21:38 +04:00
|
|
|
this.route('about');
|
2014-10-13 19:41:03 +04:00
|
|
|
this.route('tags');
|
2013-07-11 23:02:18 +04:00
|
|
|
});
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-04-08 02:01:46 +04:00
|
|
|
this.route('debug');
|
2014-06-24 03:52:10 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// Redirect legacy content to posts
|
|
|
|
this.route('content');
|
2014-06-24 03:52:10 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
this.route('error404', {path: '/*path'});
|
2014-02-26 08:58:00 +04:00
|
|
|
});
|
2014-02-27 08:45:45 +04:00
|
|
|
|
2014-05-15 04:11:46 +04:00
|
|
|
export default Router;
|