From a42894bc9a663c0b8339e19afd673d3acd4b4b85 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 24 Jun 2014 01:38:30 +0100 Subject: [PATCH] Ember admin works with subdirectory fixes #3047 --- core/client/router.js | 3 ++- core/server/helpers/index.js | 20 ++++++++++++++++++++ core/server/views/default-ember.hbs | 4 +--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/core/client/router.js b/core/client/router.js index b1fae37578..45bcf39fd1 100644 --- a/core/client/router.js +++ b/core/client/router.js @@ -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 () { diff --git a/core/server/helpers/index.js b/core/server/helpers/index.js index e3fc0f56f4..5895adfae9 100644 --- a/core/server/helpers/index.js +++ b/core/server/helpers/index.js @@ -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); diff --git a/core/server/views/default-ember.hbs b/core/server/views/default-ember.hbs index 4c681d13d6..654b06ade1 100644 --- a/core/server/views/default-ember.hbs +++ b/core/server/views/default-ember.hbs @@ -35,9 +35,7 @@ - - - + {{{ember_script_tags}}}