Ember admin works with subdirectory

fixes #3047
This commit is contained in:
Hannah Wolfe 2014-06-24 01:38:30 +01:00
parent 72b3b3ceb1
commit a42894bc9a
3 changed files with 23 additions and 4 deletions

View File

@ -1,11 +1,12 @@
/*global Ember */
import ghostPaths from 'ghost/utils/ghost-paths';
// ensure we don't share routes between all Router instances
var Router = Ember.Router.extend();
Router.reopen({
location: 'trailing-history', // use HTML5 History API instead of hash-tag based URLs
rootURL: '/ghost/ember/' // admin interface lives under sub-directory /ghost
rootURL: ghostPaths().subdir + '/ghost/ember/' // admin interface lives under sub-directory /ghost
});
Router.map(function () {

View File

@ -31,6 +31,11 @@ var downsize = require('downsize'),
'templates.js',
'models.js',
'views.js'
],
ember: [
'vendor-ember.js',
'templates-ember.js',
'ghost-dev-ember.js'
]
};
@ -357,6 +362,19 @@ coreHelpers.ghost_script_tags = function () {
return scriptList.join('');
};
coreHelpers.ember_script_tags = function () {
var scriptList = scriptFiles.ember;
scriptList = _.map(scriptList, function (fileName) {
return scriptTemplate({
source: config().paths.subdir + '/ghost/scripts/' + fileName,
version: coreHelpers.assetHash
});
});
return scriptList.join('');
};
/*
* Asynchronous Theme Helpers (Registered with registerAsyncThemeHelper)
*/
@ -811,6 +829,8 @@ registerHelpers = function (adminHbs, assetHash) {
registerAdminHelper('ghost_script_tags', coreHelpers.ghost_script_tags);
registerAdminHelper('ember_script_tags', coreHelpers.ember_script_tags);
registerAdminHelper('file_storage', coreHelpers.file_storage);
registerAdminHelper('apps', coreHelpers.apps);

View File

@ -35,9 +35,7 @@
</head>
<body class="{{bodyClass}}{{update_notification classOnly="true"}}">
<script src="/ghost/scripts/vendor-ember.js"></script>
<script src="/ghost/scripts/templates-ember.js"></script>
<script src="/ghost/scripts/ghost-dev-ember.js"></script>
{{{ember_script_tags}}}
<script>
window.ENV = {