0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/middleware
Hannah Wolfe b06f03b370 New fully-loaded & validated activeTheme concept (#8146)
📡 Add debug for the 3 theme activation methods
There are 3 different ways that a theme can be activated in Ghost:

A. On boot: we load the active theme from the file system, according to the `activeTheme` setting
B. On API "activate": when an /activate/ request is triggered for a theme, we validate & change the `activeTheme` setting
C. On API "override": if uploading a theme with the same name, we override. Using a dirty hack to make this work.

A: setting is done, should load & validate + next request does mounting
B: load is done, should validate & change setting + next request does mounting
C: load, validate & setting are all done + a hack is needed to ensure the next request does mounting

 Validate w/ gscan when theme activating on boot
- use the new gscan validation validate.check() method when activating on boot

 New concept of active theme
- add ActiveTheme class
- make it possible to set a theme to be active, and to get the active theme
- call the new themes.activate() method in all 3 cases where we activate a theme

🎨 Use new activeTheme to simplify theme code
- make use of the new concept where we can, to reduce & simplify code
- use new hasPartials() method so we don't have to do file lookups
- use path & name getters to reduce use of getContentPath etc
- remove requirement on req.app.get('activeTheme') from static-theme middleware (more on this soon)

🚨 Improve theme unit tests (TODO: fix inter-dep)
- The theme unit tests are borked! They all pass because they don't test the right things.
- This improves them, but they are still dependent on each-other
- configHbsForContext tests don't pass if the activateTheme tests aren't run first
- I will fix this in a later PR
2017-03-13 21:13:17 +01:00
..
api 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00
validation 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00
brute.js 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00
cache-control.js deps: grunt-jscs@2.1.0 2015-10-12 19:21:16 +01:00
custom-redirects.js 🐛 fix usages of logError (#8138) 2017-03-13 19:47:09 +00:00
error-handler.js 🎨 🐛 Improve theme lib, middleware & error handling (#8145) 2017-03-13 17:30:35 +01:00
ghost-locals.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
labs.js 🎨 configurable logging with bunyan (#7431) 2016-10-04 16:33:43 +01:00
log-request.js chore(package): update uuid to version 3.0.0 (#7742) 2017-01-04 17:10:29 +01:00
maintenance.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
pretty-urls.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
redirect-to-setup.js 🎨 add urlFor('admin') and increase usage of urlFor helper (#7935) 2017-02-02 18:51:35 +00:00
serve-favicon.js 🎨 Move settings cache & cleanup settings API (#8057) 2017-02-27 16:53:04 +01:00
serve-shared-file.js 🔥 remove forceAdminSSL and urlSSL, add admin url (#7937) 2017-02-03 18:13:22 +00:00
static-theme.js New fully-loaded & validated activeTheme concept (#8146) 2017-03-13 21:13:17 +01:00
theme-handler.js New fully-loaded & validated activeTheme concept (#8146) 2017-03-13 21:13:17 +01:00
uncapitalise.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
url-redirects.js 🎹 re-work url redirects (#7956) 2017-02-10 11:42:18 +00:00