diff --git a/.gitignore b/.gitignore index 171741400e..9132708bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -65,7 +65,7 @@ config.*.json # Built asset files /core/built -/core/server/admin/views/default*.hbs +/core/server/admin/views/* /core/shared/ghost-url.min.js # Coverage reports diff --git a/Gruntfile.js b/Gruntfile.js index a10d014dab..c59454f567 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -46,7 +46,7 @@ var overrides = require('./core/server/overrides'), pkg: grunt.file.readJSON('package.json'), clientFiles: [ - 'server/admin/views/default.hbs', + 'server/admin/views/default.html', 'built/assets/ghost.js', 'built/assets/ghost.css', 'built/assets/vendor.js', diff --git a/core/server/admin/app.js b/core/server/admin/app.js index d8191c5b47..76e0473a98 100644 --- a/core/server/admin/app.js +++ b/core/server/admin/app.js @@ -1,8 +1,6 @@ var debug = require('debug')('ghost:admin'), config = require('../config'), express = require('express'), - adminHbs = require('express-hbs').create(), - // Admin only middleware adminMiddleware = require('./middleware'), @@ -27,14 +25,6 @@ module.exports = function setupAdminApp() { next(); }); - // @TODO replace all this with serving ember's index.html - // Create a hbs instance for admin and init view engine - adminApp.set('view engine', 'hbs'); - adminApp.set('views', config.get('paths').adminViews); - adminApp.engine('hbs', adminHbs.express3({})); - // Register our `asset` helper - adminHbs.registerHelper('asset', require('../helpers/asset')); - // Admin assets // @TODO ensure this gets a local 404 error handler configMaxAge = config.get('caching:admin:maxAge'); diff --git a/core/server/admin/controller.js b/core/server/admin/controller.js index a5b0947819..9e6d9c3f05 100644 --- a/core/server/admin/controller.js +++ b/core/server/admin/controller.js @@ -1,10 +1,11 @@ -var debug = require('debug')('ghost:admin:controller'), - _ = require('lodash'), - config = require('../config'), - api = require('../api'), - updateCheck = require('../update-check'), - logging = require('../logging'), - i18n = require('../i18n'); +var debug = require('debug')('ghost:admin:controller'), + _ = require('lodash'), + path = require('path'), + config = require('../config'), + api = require('../api'), + updateCheck = require('../update-check'), + logging = require('../logging'), + i18n = require('../i18n'); // Route: index // Path: /ghost/ @@ -34,9 +35,10 @@ module.exports = function adminController(req, res) { } }); }).finally(function noMatterWhat() { - var defaultTemplate = config.get('env') === 'production' ? 'default-prod' : 'default'; + var defaultTemplate = config.get('env') === 'production' ? 'default-prod.html' : 'default.html', + templatePath = path.resolve(config.get('paths').adminViews, defaultTemplate); - res.render(defaultTemplate); + res.sendFile(templatePath); }).catch(function (err) { logging.error(err); });