mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 21:40:39 +03:00
9092ed95ba
closes #174 - Triggering router events for navigation between settings panes caused the route function to be re-executed, which caused all kinds of fun. - Wrapped the settings route function in an if statement to preserve the current view if it already a settings view. - Added Ghost pub-sub and using that instead of History API
41 lines
950 B
JavaScript
41 lines
950 B
JavaScript
/*globals window, $, _, Backbone */
|
|
(function () {
|
|
"use strict";
|
|
|
|
var Ghost = {
|
|
Layout : {},
|
|
Views : {},
|
|
Collections : {},
|
|
Models : {},
|
|
|
|
settings: {
|
|
apiRoot: '/api/v0.1'
|
|
},
|
|
|
|
// This is a helper object to denote legacy things in the
|
|
// middle of being transitioned.
|
|
temporary: {},
|
|
|
|
currentView: null,
|
|
router: null
|
|
};
|
|
|
|
_.extend(Ghost, Backbone.Events);
|
|
|
|
Ghost.init = function () {
|
|
Ghost.router = new Ghost.Router();
|
|
|
|
// This is needed so Backbone recognizes elements already rendered server side
|
|
// as valid views, and events are bound
|
|
Ghost.notifications = new Ghost.Views.NotificationCollection({model: []});
|
|
|
|
Backbone.history.start({
|
|
pushState: true,
|
|
hashChange: false,
|
|
root: '/ghost'
|
|
});
|
|
};
|
|
|
|
window.Ghost = Ghost;
|
|
|
|
}()); |