Commit Graph

62 Commits

Author SHA1 Message Date
Hannah Wolfe
de7143bc62 Refactoring Ghost middleware
closes #657, closes #761

- Got rid of initTheme from ghost.js (yay)
- Divided up the logic for static assets and views
- Ghost admin static assets are now served from /ghost/
- New logic to figure out if we're on the admin, or a theme and which theme we are on
- Activate theme method reregisters static access and uncaches views
- Re-ordered all of the middleware, and ensured we had a 404 handler at the end
- Activate theme method ensures that middleware maintains order
2013-09-17 01:49:08 +01:00
Hannah Wolfe
42a5e74ddb Cleaning up code that is not needed 2013-09-17 01:49:00 +01:00
Jacob Gable
63eb9581ea Compile assets with grunt
- Made a helper called ghostScriptTags that will spit out the relevant
  script tags with version parameter; 4 unminified files in development,
  1 minified file in production.
- Added grunt concat and uglify tasks to build files into core/built
- Fixed some unit tests by making them native date objects
2013-09-15 14:06:42 -05:00
Sebastian Gierlinger
8f22737f04 Make settings() 'magic'
- access value directly by using ghost.settings('key')
- removed use of <key>.value
- removed workaround for activeTheme path
2013-09-15 19:52:37 +02:00
Sebastian Gierlinger
bd8db968ea Add setting filter
closes #172
- added type to ghost.settings()
- added /api/settings?type=<filter>
- added availableThemes to settingsCache
- removed cachedSettingsRequestHandler
- removed /api/themes (including front end)
- changed activePlugins to type "plugin" in default-settings.json
2013-09-15 18:04:01 +02:00
Adam Howard
3823d10c35 Restructure default-settings.json and add validations to important settings. 2013-09-14 14:29:27 +01:00
Adam Howard
00199cee67 Refactor the initial boot of Ghost, allowing Ghost updates to keep current configuration intact.
Extracts all express-server-related code in index.js to core/server.js, leaving index.js purely for booting up Ghost's core components in a sensible order.

Aside from the project's tidiness, this means that we can perform asynchronous configuration loading/checks before requiring any modules that read the config.
2013-09-12 15:38:11 +01:00
Sebastian Gierlinger
212521712d Clean up config (drop 'env')
closes #628
- removed .env from config.js
- ghost.config() returns correct config for NODE_ENV
- removed .env[process.env.NODE_ENV]
- updated tests
- deleted users.hbs, plugins.hbs, appearance.hbs (forgot to delete in PR #649)
2013-09-12 15:25:58 +01:00
Hannah Wolfe
6417ef778a Added blog cover image
closes #571

- added blog cove beneath logo, wired it up to the {{@blog}} globals
- updated casper
- also deleted settings/content
2013-09-09 18:13:19 +01:00
Sebastian Gierlinger
d9fb23496c Clean up config (non-env based settings)
closes #625
- removed defaultLang, forceI18n and activePlugins from config
- added values to default-settings.json
- updated to use values from settings
2013-09-06 18:46:50 +01:00
Seth Lilly
57e3bed9d9 Corrected typo in code documentation
Corrected typo in code documentation

-Changed "atricle" to "article"
2013-09-04 13:45:14 -04:00
Adam Howard
e24b5c3382 Proper settings infrastructure, allowing new features without compromising old data.
On server load, check for settings which have not been set, and apply a default value to the settings table from a JSON file.
2013-09-03 22:56:34 +01:00
Hannah Wolfe
6978dec198 Global settings cleanup 2013-09-03 11:38:10 +01:00
Hannah Wolfe
36874badd5 Merge pull request #587 from javorszky/iss288
Email sending with Sendgrid plus password reset
2013-09-02 15:44:48 -07:00
Hannah Wolfe
be62a550f9 Global settings for themes
issue #389

 - Upgrade express-hbs to get template options access
 - Grab config & settings with a hacky new method in ghost & pass to template options
 - Settings are no longer passed to res.locals
2013-09-02 20:58:49 +01:00
Hannah Wolfe
56b7f925da Improved theme loading
- In some cases, Ghost exploded when the active theme did not have a partials directory
- Added handling for if the active theme was not present
- Probably will conflict with #574 I need to fix this.
2013-09-02 11:35:09 +01:00
Ricardo Tomasi
56619a87f8 Implement e-mail sending 2013-08-31 22:21:33 +02:00
Sebastian
4525c355af Adding theme switcher to settings/general
closes #488 and #107
- added dropdown for theme selection on general page
- added GET /api/v0.1/themes to retrieve available themes
- modified settings model to get available themes
- modified updateSettignsCache to remove path from settings.activeTheme
2013-08-30 13:20:30 +02:00
cobbspur
00d36e976d added ghost_head and ghost_foot helpers
closes #382, closes #383

 - added helper called ghost_head to insert meta data with current version of ghost
 - added helper called ghost_foot to insert script tag for jquery
 - added unit test for both helpers
 - removed trailing slash from ghost.js for 'shared' path and removed from outside of loop as it is shared on front and backend
2013-08-25 14:34:35 +01:00
Gabor Javorszky
3ded75ca4f Dropping the database invalidates cookies
Closes #418.
* Moved the app config behind the promise wall (I couldn't reliably assign generated uuid to the ghost object AND have access to an automatically created db from fixtures AND not have circular reference (try including api in ghost.js ;) ))
* Added new functionality to `ghost.init()`, which is responsible for the first run bit (I'm thinking plopping a filter or an action in there for future devs)
* Modified `.gitignore` so the `.png`s casper generates aren't added
* Fixed ambiguity and typos here and there, see code
2013-08-24 01:02:01 +01:00
Jacob Gable
bbe5105048 Edit Post Permissions 2013-08-18 12:28:05 -05:00
Gabor Javorszky
f6d164b5d8 Current user added
Closes #340. Closes #375
* Replaced session with id of current user
* Added method to ghostlocals to always send profile picture and full name to templates (template checks if falsy)
* Modified user saving (`forge().set(new).save()` died on me, `forge().save(new)` didn't)
* If user has profile picture, that will be used
* If user has name, that will be used
* Password changing doesn't care about your email. Uses cookies. Tasty!
* User pane uses current user id. Had to set path to me, otherwise goes to `browse` instead of `read`.
* Added logic to user api to check for `id === 'me'`, and then use the cookie value
* User data saves are now correct
* There is no logout error
2013-08-17 22:02:46 +01:00
Hannah Wolfe
cbcd3c8efe Improving the use of paths in Ghost
fixes #392

- adds appRoot, and uses this to calculate other paths
- removes path calculations from loader
- remove the themedir setting in config.. completely unnecessary
- highlights just how important #360 is
2013-08-12 15:37:23 +01:00
Hannah Wolfe
2f11f053ab Minor code cleanup, docs and other bits & pieces 2013-08-06 22:24:40 +01:00
Jacob Gable
0238909281 Initial Plugin API Implementation
Implements basic functionality described in #227 for loading plugins
from a specific directory and having a specific workflow with an init()
method and a disable() method.
2013-08-05 11:15:17 -05:00
Hannah Wolfe
338109c762 Data models import, export, and reset for 002
- added line to index.js to set node_env to development if it is not set
 - fixed a small bug with the persistent notifications and used them on debug page from server side
 - added 002 files to manage export and import for 002
 - 002 import is somewhat smarter than 001, merging settings (except version), replacing user & clearing primary keys
 - added reset to models and migration, which does the down operation the same way that init does the up operation
 - import and reset clear session & redirect to login / signup
 - additional unit tests
2013-08-05 13:56:30 +01:00
Jacob Gable
d40c08218e Allow theme partials to override helper templates
Added an existence check to the loadTemplates function
2013-08-02 13:36:37 -05:00
Ricardo Tomasi
814a3d66b7 Move shared third-party libraries to /shared/vendor 2013-07-24 23:21:57 +01: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
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
Hannah Wolfe
b70867c973 Filters should not stop execution.
- added a try-catch & error logging to filters so that they can be debugged and do not stop execution
2013-07-07 19:02:26 +01:00
Hannah Wolfe
5c15c2d4b0 issue #186 - load plugins
- Adding activePlugins array to config.js
- Adding a loadPlugins function to ghost.js
- Tweaking fancyFirstChar.js so that it works again, getting rid of the function wrapper and constructor
2013-07-01 20:24:48 +01:00
Gabor Javorszky
6ab8109f40 Getting rid of adminnavbar filter and console.logs
Closes #219. Self-explanatory, look at the code.
2013-06-30 16:50:26 +01:00
Hannah Wolfe
30bc4d8434 Fix for WOFF files
- get express to return the correct mime type for woff files
2013-06-25 22:47:29 +01:00
Hannah Wolfe
289a40e031 Cleaning up res.locals
- closes #124
- added new middleware to detect if a route should be admin or not
- updated ghostLocals to use this and return different locals
- updated ghost.js#initTheme to use the same test
2013-06-25 22:36:53 +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
Hannah Wolfe
50eb91fe51 issue #165 - reloading settings
- ghost.js - split the settings loading out of ghost.init, so that we have a function for loading / reloading settings
- api.js - implemented a new requestHandler, the cachedSettingsRequestHandler which handles all aspects of local caching for settings when making requests
- app.js - updated the settings api routes to use the new cached request handler
2013-06-17 23:24:05 +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
Hannah Wolfe
0f0769ab2b issue #157 - init ordering and error handling
reordering init so that settings are always loaded after the db is initialised
adding error handling to promises
2013-06-16 17:14:01 +01:00
Jacob Gable
a63690a471 Fix relative paths for deployment
In order to run with forever / supervisorctl, the relative paths need to
be converted to full ones based on the __dirname.
2013-06-15 10:54:49 -05:00
Gabor Javorszky
81d317a122 Replaced config.blogData with settings
Solves #112
* Removed config.blogData
* Changed Ghost.init() to accommodate new settings bits
* (data was already in the fixtures)
2013-06-15 00:39:27 +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
983c171fb0 simplifying the model structure, again 2013-06-01 11:14:05 -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
Jacob Gable
a8bf3c962f Ghost.init()
- Modified jsonDataProvider to return promises for findAll and save
- Move the dataProvider initialization into the Ghost.init() function.
- Created basic unit test
2013-05-30 23:39:02 +01:00
Gabor Javorszky
ce5e757672 moved config into init function 2013-05-30 23:39:02 +01:00
Gabor Javorszky
e7c0d13f7c #73: Remap app.locals done 2013-05-30 23:39:02 +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