Commit Graph

46 Commits

Author SHA1 Message Date
Rish
e26635620e 🐛 Fixed theme upload error when overriding existing
no issue

- Cache invalidation header was set wrongly in frontend theme service
- This moves cache invalidation out of theme service to themes controller by passing `themeOverriden` flag along with theme
2019-07-11 15:34:15 +05:30
Naz Gargol
f3ec2fb2f7
Cleaned up theme service (#10884)
refs #10790

- Following TODO in theme index file was waiting for 2 years, and today is the day to cross it out:
- "Reduced the amount of things we expose to the outside world"
- "Made this a nice clean sensible API we can all understand!" - by @ErisDS
- Cleaned exposed methods from themes module
- Removed unused storage getter
- Removed list method
- Removed validate method
- Renamed Storage to ThemeStorage
  - Named the file the same way the class defined inside of it is named
  - Naming was conflicting with coming rename of  `settings` -> `storage`
- Renamed theme settings to storage
2019-07-09 16:35:18 +02:00
Hannah Wolfe
ce563179b8 🐛 Fixed infinite redirect for amp when disabled
fixes 10883

- fixed an issue where /amp/ pages would cause an infinite redirect loop
- this only occurred when amp was disabled, and query params were passed to the /amp/ url
- this fix resolves the issue by not assuming /amp/ is the end of the URL
- it also checks for `/amp/` (both slashes) and replaces one
2019-07-08 17:32:12 +01:00
Naz Gargol
4529ab514c
Themes controllers code extraction (#10818)
refs #10790

- Extracted 'setFromZip' method into themes services
- Extracted 'activate' method
- Extracted 'destroy' method
- Extracted 'download' method
- The method name here tries to follow 'setFrom...` convention we've agreed upon. So, in this case, we have get() which returns JSON response and getZip() which returns a file
2019-07-01 16:56:23 +02:00
Naz Gargol
0bf1542bc6
Extracted settings service part manipulating routes.yaml (#10800)
refs #10790
refs #9528

- The settings service was designed to handle more settings then just routing, but till this day there wasn't anything else added. As routes.yaml is only being used by frontend router so conceptually it fits better to have this code in frontend, so that it doesn't have to reach out to server
- The code left in server settings is the one that interacts with the database `settings` table and only partially provides information to frontend. That part is known as 'settings cache' and will be accessed through API controllers.
2019-06-25 18:33:56 +02:00
fueko
dcb3512d7d Made pagination helper template output W3C compliant HTML (#10804)
no issue

- Removed unneeded role="navigation" attribute from <nav> in pagination.hbs as speced in validator.w3.org/nu/#textarea
2019-06-25 12:01:19 +02:00
Fabien O'Carroll
15585971e2 🐛 Fixed async helpers nested in template helpers
closes #10643

The async resolver in express-hbs relies on storing the state of the
promises on the `this` value inside of a helper, which is always set to
the `context`. This patch updates our helpers which render templates, to
use `this` as the context when rendering their templates.
2019-06-25 16:19:33 +07:00
Nazar Gargol
e056c770da Fixed a crash when theme is changed
refs #10790

- The error was happening due to wrong reference to the site app from themes service
- The issue was introduced in df7e64fafa
2019-06-24 13:59:41 +02:00
Nazar Gargol
22f56c95a8 Fixed redirects.json file validation
refs #10790

- Reference to method previously used to validate wasn't updated during refactoring done in be27db46eb
2019-06-24 10:56:30 +02:00
Naz Gargol
8ae5db9922
Extracted frontend code from settings API controllers (#10797)
* Moved settings#upload method out of settings controller

* Moved out code from download to serve method

* Moved API v0.1 settings upload/downalod routes.yaml methods to use setting handler service

* Reverted unintended change

* Moved RoutesHandler into settings module

- To keep in convention with settings described in - https://github.com/TryGhost/Ghost/issues/9528 , extracted routes handler into separate settings folder

* Frontend settings for API v0.1

* Renamed 'routes' to 'dynamic-routing'

* Renamved activate/serve methods as suggested in discussions

* Moved settings dynamicRouting to routing.settings
2019-06-21 16:52:07 +02:00
Naz Gargol
be27db46eb
Extracted frontend code from redirects API controllers (#10798)
refs #10790

- The code was moved out of controllers to reduce the number of coupling points between the API controllers and "frontend" services
- A nice side effect of this move is a decreased amount of code that will need to be maintained and reusability between existing controllers
- Calling just a few methods from frontend services on API level makes it easier to abstract fronted away from API
2019-06-21 16:50:16 +02:00
Nazar Gargol
c7522f896b Moved settings dynamicRouting to routing.settings 2019-06-21 16:34:17 +02:00
Nazar Gargol
a84c15689e Renamved activate/serve methods as suggested in discussions 2019-06-21 13:58:26 +02:00
Nazar Gargol
f3b4e2e39a Renamed 'routes' to 'dynamic-routing' 2019-06-21 13:12:23 +02:00
Nazar Gargol
61dc9e8c24 Moved RoutesHandler into settings module
- To keep in convention with settings described in - https://github.com/TryGhost/Ghost/issues/9528 , extracted routes handler into separate settings folder
2019-06-20 16:58:26 +02:00
Nazar Gargol
dc68f37b86 Reverted unintended change 2019-06-20 16:27:37 +02:00
Nazar Gargol
06a6dc835d Moved API v0.1 settings upload/downalod routes.yaml methods to use setting handler service 2019-06-20 13:34:22 +02:00
Nazar Gargol
8709f5cc55 Moved out code from download to serve method 2019-06-20 13:23:58 +02:00
Nazar Gargol
c3b14f82fd Moved settings#upload method out of settings controller 2019-06-20 13:19:22 +02:00
Naz Gargol
df7e64fafa
Extracted frontend folder (#10780)
refs #10790

- Moved /core/apps into core/frontend
- Moved /core/server/helpers to /core/frontend/helpers along with /core/server/services/themes
- Changed helper location in overrides
- Moved /core/server/services/routing to /core/frontend/services
- Moved /core/server/services/url to /core/frontend/services
- Moved /core/server/data/meta to /core/frontend/meta
- Moved /core/server/services/rss to /core/frontend/services
- Moved /core/server/data/xml to /core/frontend/services
2019-06-19 11:30:28 +02:00
Hannah Wolfe
30b4eb07f7 App restructure - closes #245
- This is a first pass at getting a more logical structure. The focus is on moving from admin/frontend to client/server.
- The location of the databases is highly important, this isn't expected to change again
In the future
- client/assets should probably become public/
- more stuff should be shared (helpers etc)
- cleanup some confusion around tpl and views
2013-07-11 20:23:34 +01:00
Hannah Wolfe
316a50b7ff Issue #246 part 12
-  renamed single.hbs to post.hbs
- casper updated to match
2013-07-11 17:57:12 +01:00
Hannah Wolfe
2b132f32b1 Content helper - closes #254
- return content as a safe string so triple taches are not required
- test for content helper
2013-07-11 17:21:42 +01:00
ErisDS
6f8752aa22 HTML helpers refactor - issue #246 items 2 and 5.
- moved template logic out of individual helpers and into Ghost
- simplified template-driven helpers into closures which maintain the context of handlebars
- with handlebars context we have access to data, so don't need to pass data in
- check data to test that it is a simple object and not a function
- moved helpers back into index.js
- provided tests for both template functions in ghost and the nav helper so we are back to where we were
2013-07-11 01:30:29 +01:00
ErisDS
0dd0d20678 Nav helper bug - home page always marked as current
- fixed a bug whereby once you visit the homepage the homepage menu item is always marked as the active page
- this was due to passing the config object being done by reference rather than by value, and therefore setting the selected item was persisted.
2013-07-11 01:30:29 +01:00
ErisDS
53fe5e3ba3 HTML helpers work with double taches - issue #246 item 1.
- updated navigation and pagination helpers to use SafeString
- nav and pagination don't need triple taches any more
- nav tests updated, and renamed to match helper name
2013-07-11 01:30:29 +01:00
cobbspur
8bbacd9ec9 closes #195 posts date on content page
- adds dateFormat handlebars helper for client side with extra option to format in time since style
- adds this extra dateFormat option to existing server side helper.
- adds scss for draft and scheduled status
- adds true/false values to post for draft  and published to validate in handlebars
- changes admin>content post collection query to order posts by updated_at values in router.js
- adds minified moment.js and links to moment.js and helper.js for clientside
2013-07-04 19:42:49 +01:00
Hannah Wolfe
199d15133b Navigation Helper
- renamed helper from ghostNav to nav and file from ghostNav to navigation
- switched template to use current-menu-item as per the styles
- cleaned up several unused items from config, and removed default link to admin
- updated tests
2013-06-25 22:44:34 +01:00
cobbspur
376cf647e5 closes #197 & closes #196 pagination wiring and helper
- adds routes for homepage pagination
- adds helper function to compile template file for pagination
- adds next and prev to post for next and previous page
- adds handlebars template for pagination
2013-06-25 16:13:19 +01:00
Hannah Wolfe
ba810fb0bb issue #58 - removing the iiwf
Function wrapper and use strict pragma removed from all node files
2013-06-25 13:46:50 +01:00
cobbspur
bf9c55a6fb closes #187 foreach column parameter
- adds keys @rowStart and @rowEnd in foreach helper based on an argument passed in for the number of columns desired
- added setKeys function to remove  duplication code
2013-06-23 16:46:02 +01:00
Hannah Wolfe
32bbf2ba57 issue #165, issue #124 - cleaning up ghostGlobals
- ghost.js - globals/globalConfig has become settings / settingsCache to make it clearer
- app.js - the ghostGlobals local cache is gone, and the use of res.locals has been cleaned up and simplified, although this needs to be properly split into frontend and admin locals (to be finished in #124)
- frontend/index.js - doesn't need to be passed globals and nav properties as res.locals does this for us
2013-06-17 23:12:13 +01:00
cobbspur
b9e1ddcb2e Adds handlerbars helper 'foreach'
Function allows you to iterate through an array or object  in handlebars
Sets Key Values for @first/ @last entry and @odd/@even to true/false
2013-06-16 14:12:28 +01:00
Gabor Javorszky
e271c6402f Directory scanning on contents/themes and plugins
This implements #106.
* Added require-tree which is based off of @ricardobeat's module. Fully async.
* I've moved active theme and active directory to settings from config as well.
* Modified settings.hbs and settings.js to display the raw json under Settings/Appearance
2013-06-09 20:17:54 +01:00
Jacob Gable
55d8ff75b4 Filter priorities
Add the ability to specify a priority level when registering filters.
Also change doFilter to execute filters in priority order.

Closes #86
2013-06-09 11:16:25 -05:00
Tim Griesser
30bd89587f server half of #83, posts are draft by default, browse shows published by default 2013-06-03 00:56:17 -04:00
ErisDS
185eee2a6b Implementing backbone for the blog / content view
closes #64 - adds a full example of using backbone on the frontend
remembered to squash this one!
2013-05-31 06:58:20 +01:00
ErisDS
237af40f2e Revert "Merge branch 'fat-models' of github.com:tgriesser/Ghost into tgriesser-fat-models"
This reverts commit 611e6a49ef, reversing
changes made to a89dc1d123.
2013-05-30 23:34:53 +01:00
Tim Griesser
cf9c2462fa lint fixes 2013-05-29 18:28:24 -04:00
Tim Griesser
091790a525 merging with master 2013-05-29 18:26:10 -04:00
Jacob Gable
e60fa79bae Merging from upstream 2013-05-28 17:41:28 -05:00
Jacob Gable
c699121049 Add ghostNav helper and filter for themes; closes #47 2013-05-27 22:59:01 -05:00
Jacob Gable
47f49bbb4b Add ghostNav helper and filter for themes; closes #47 2013-05-27 14:48:16 -05:00
Tim Griesser
a204a96cda a bit of organizing/simplifying/fattening the models 2013-05-27 13:30:03 -04:00
Hannah Wolfe
58926d1ce4 Updating controllers to use the api + some minor changes to the api calls 2013-05-16 21:56:26 +01:00
Hannah Wolfe
17d421bfcc Initial commit to GitHub repo 2013-05-11 17:44:25 +01:00