Commit Graph

265 Commits

Author SHA1 Message Date
Hannah Wolfe
395079cd2f Unify code for picking a template to render with
refs #5091

- 100% coverage for new frontend/templates file
- new module handles the logic for determining which template to render with
2015-12-01 12:05:46 +08:00
Hannah Wolfe
d6fb21fa28 Don't use api to lookup theme in frontend controller
no issue

- small fix, we already have the info, no need to look it up again
2015-10-30 19:02:06 +00:00
Hannah Wolfe
ff7517b801 Switch RSS to use new filter param
refs #5943, #5091

- split out channel config
- use config.theme instead of api calls to grab title & desc
- wrap rss call in a function which sets channel config for RSS feeds
- change rss `getData` function to use the new multiple-query-handling fetchData functionality
- make sure channelConfig is set in all tests
2015-10-27 10:00:51 +00:00
Hannah Wolfe
e9035fde4e Switch frontend controller to use new filter param
refs #5943, #5091

- updated fetch-data to handle multiple api queries
- using named keys for queries so that the names of items in the result are correct (tag instead of tags etc)
- updated channel configs in frontend controller
- removed old filter code from frontend controller
- added test coverage for fetch-data and format-response
- fixes / removes tests which are broken by the refactor
2015-10-26 09:40:19 +00:00
Hannah Wolfe
06b03bbcfe Split helper functions from frontend controller
no issue

- Split out 'getPostPage' & rename to fetchData
- Split format response methods into own files
- Split out handleError
- Split out setReqCtx and rename to setRequestIsSecure
- Split out theme paths
- Refactor tests in index_spec.js to be more robust
- Add tests to bring coverage for split file up to 100%
2015-10-22 18:46:58 +01:00
Hannah Wolfe
c8bb6081ab Frontend controller refactor & test improvements
no issue

- Split context out of frontend controller
- Add 100% test coverage for context
- Add tests for preview & improve other bits of coverage
- Further refactors (WIP) will make it easier to reach 100% coverage on the frontend
2015-10-15 10:17:42 +01:00
Hannah Wolfe
26231d5bd3 Fix /author/ pages crashing & permit /tag/
fixes #5905

- update context patterns to correctly match author & tag pages
- remove 'tag' and 'tags' from reserved slugs - we'll handle this in terms of overrides in future
2015-10-10 14:52:23 +01:00
Nazar Gargol
fd7e118ed5 Returns 404 page instead of crashing a server whenever special characters are used for tag filtering
closes #5808
refs #5816
- adds additional filtering any 'slug' containing content in `renderChannel` for frontend
- adds test for invalid characters in tag slug
2015-09-20 22:47:34 +02:00
Sebastian Gierlinger
f22796ff7d Add dynamic client_id/client_secret
no issue
- added ghost-admin client_id to admin
- added ghost-admin client_secret to admin
- added client.read() api endpoint
- added random generation of client_secret to migration
- removed addClientSecret method
- updated tests
2015-09-02 16:39:34 +01:00
Kevin Ansfield
7ac6ebb920 Refactor notifications service & components
issue #5409

- change persistent/passive notification status to alert/notification
- replace showSuccess/Info/Warn/Error with showNotification/showAlert
- fix and clean up notification/alert components
2015-07-28 12:26:11 +01:00
Jason Williams
60e160d169 Merge pull request #5361 from ErisDS/fix-contexts
Fix context setup (remove dep on req.route.path)
2015-06-03 16:28:16 -05:00
Hannah Wolfe
7eacd2876d Ensure middleware functions are named
refs #5091

- adds names to all middleware functions, for debugging purposes
2015-06-02 14:49:18 +01:00
Hannah Wolfe
cc00c6c64a Fix context setup (remove dep on req.route.path)
refs #5344

- As a result of #5344, context are pretty broken.
- This PR removes all dependence on req.route.path, and uses res.locals.relativeUrl
- res.locals.relativeUrl is used for many things and is dependable
2015-05-29 09:16:04 +01:00
Austin Burdine
75745c2b3b refactor permalink verification in single post controller
closes #4322
- removes verifying "sections" of permalinks in favor of checking the url returned with the post
- fixes unit tests to define post.url in mock post requests
2015-05-20 07:00:13 -06:00
Hannah Wolfe
c3dda5e5c4 Theming updates for password protection
refs #4993, #5073

- Removed nonexistent helpers siteDescription and bodyClass from admin templates
- Changed password.hbs to private.hbs to match the route name
- added a new input_password helper for rendering the password input with the correct properties
- removed the forward input as this can be handled via urls only
- moved 'private' to routeKeywords
- added 'private' context
- minor update to text next to the password in settings
2015-05-13 19:48:24 +01:00
Hannah Wolfe
96a3568c3d Merge pull request #5197 from PaulAdamDavis/new-upgrade-notifications
Move upgrade notification to /settings/about/
2015-05-13 16:47:46 +01:00
Austin Burdine
8ac168794e refactors the frontend controller
closes #5192
- combines homepage, author, tag routes into one function (with different hash params)
- provides some abstraction for channels
2015-05-05 07:35:08 -05:00
Austin Burdine
2865662ee5 added password protection
closes #4993
- brings password protection to the frontend of blogs
- adds testing for password protection
- upgrades bcrypt-js to 2.1.0
2015-04-30 23:44:43 -05:00
Matt Enlow
433956c102 Add post preview via uuid (/p/:uuid)
Refs #5097

- All drafts will show a preview link (this needs real css)
- Published posts will redirect
- prev/next post helpers only activate on published posts
- Powered by ~10 pints between the two of us (@ErisDS, @novaugust)
2015-04-30 11:57:37 +01:00
Paul Adam Davis
272f1eddaf Move upgrade notification to /settings/about/
Refs #5071

- Move the Upgrade notification from the top of the screen to the About page
2015-04-29 22:34:04 +01:00
lmoe
03dcb71b08 Added res.locals into the prePostsRender filter call
closes #2559

 - Added res.locals as a second parameter to the prePostsRender filter
call.
 - This allows accessing the relative url and makes it possible to
react to certain urls.
2015-04-22 23:22:31 +02:00
Sebastian Gierlinger
fdcb67d3cc Rename error.type to error.errorType
closes #5178
- renamed error.type to error.errorType
2015-04-22 22:29:45 +02:00
Hannah Wolfe
e26e83d40a Refactor to remove author.email from API
refs #2330

- Pass through `options` to all toJSON calls on posts, tags, and users
- Use options.context.user to determine whether it's OK to return user.email
- Remove author.email handling code from frontend.js
2015-04-17 22:27:04 +01:00
Hannah Wolfe
8d1e729f30 RSS Refactor with cache
refs #5091, refs #2263

- Move rss handling out of the frontend controller and into its own module
- Separate the code into logical blocks
- Wrap the generation code in a in-memory cache to prevent it being regenerated on every request
2015-04-10 21:32:14 +01:00
Sebastian Gierlinger
8f5960e1c5 Merge pull request #5108 from ErisDS/rss-2
Add media:content support to RSS
2015-04-10 12:49:51 -05:00
Hannah Wolfe
14134fb4b0 Add media:content support to RSS
refs #2263, #4888

- Adds media:content element to Ghost Rt pSS feeds containing the post cover image if one is available
- Removes the prepending of the image to the `<description>` field
- Keeps the prepending of the image in `<content:encoded>`
2015-04-06 18:47:10 +01:00
Hannah Wolfe
527e4eed06 Remove duplicate subdirectory in RSS urls
fixes #5064

- this is a quick and dirty fix for now
2015-04-05 23:30:22 +01:00
Matt Enlow
242388f743 Merge pull request #5065 from ErisDS/rss-2263
Improve RSS feed
2015-04-04 07:55:33 -06:00
Hannah Wolfe
79d213436e Improve RSS feed
refs #2263

- Switch content type back to text/xml
- Use content:encode for full content
- Use meta description or first 50 words of content for description
2015-04-03 19:00:00 +01:00
Katie Fenn
980b0a8610 Refactoring hard-coded frontend route keywords
closes #4519

- Added configurable route keywords
- Replaced instances of hard-coded keywords with config
- Added keywords to frontend tests stub config
2015-03-23 15:00:02 +00:00
Pascal Borreli
13838fff9d Fixed typos 2015-03-17 17:43:53 +00:00
Felix Rieseberg
436d2a8e42 RSS: Don't add trailing '/' to post image
Closes #4888

We automatically added a trailing slash to all non-absolute paths in
RSS, including post images. This fix ensures that trailing slashes
aren’t added to absolute paths including ‘content/images/‘.
2015-03-02 20:51:32 +01:00
Hannah Wolfe
2450f18170 Make the {{navigation}} helper global
refs #4535

- Rather than storing navigation data as a top level key, store it as @blog.navigation
- Reference the global data from the helper
2015-02-28 12:53:00 +00:00
Sebastian Gierlinger
8b4979c7d1 Merge pull request #4919 from ErisDS/pr/4852
Update to PR 4852 ({{navigation}} helper)
2015-02-18 20:00:34 +01:00
Hannah Wolfe
6d42df029a Navigation helper amends
closes #4541

- Add role="presentation" to <li>
- Clean up space if nav-current isn't present
- Changed all internal references from nav to navigation for consistency
- Deleted old nav.hbs
- Updated tests
2015-02-15 21:44:10 +00:00
Marcos Ojeda
d28ffef3e9 Add {{navigation}} helper
closes #4541
creates a handlebars helper with behavior matching the spec in #4541 and
updates `frontend.js` to include the navigation data in the rendered page
context.
- checks for {{current}} against `relativeUrl`
- adds helper `getSiteNavigation()` which returns contents of
  `api.settings.read('navigation')`, or an empty list
- navigation helper is responsible for filtering and consistently formatting
  navigation data from settings.
- changes `frontend.js`'s `formatResponse` & `formatPageResponse` to return
  a promise with page data and updates frontend controllers to use it.
- `formatPageResponse` now includes a third parameter to allow values to be
  merged into the page response (rather than using `_.extend` in the
  render methods directly.
- {{navigation}} will render an empty `ul` if no navigation items exist
- incorporates {{url}}/urlFor behavior for nav contexts. (see #4862)
- uses {{url absolute="true"}} in default nav template
2015-02-13 08:38:18 -08:00
Felix Rieseberg
762a47b6bf Add Post Image to RSS Feed
Closes #4888

- If a post cover image exists, it is added to the `description` tag
(at the very front). This allows RSS readers to pic up the picture.
2015-02-10 14:04:59 -08:00
Jason Williams
921f7dab5b Fix error in generating absolute URLs for RSS
Closes #4886
2015-02-03 21:10:06 +00:00
Jason Williams
b06d2a619d Use path-match to match routes instead of Router
No Issue
- Use path-match instead of hacking up the Express.Router internals.
2015-01-22 19:21:47 +00:00
Nazar Gargol
df5a598718 Cleans up HTML data attributes on body in default.hbs
closes #4485

- removes data attributes used on body in default.hbs
- introduces new way to generate configuration through meta tags
- config initializer consumes configurations from the meta tags using parser
- moves blog_title helper/value to be a property in a configuration api
2014-11-29 17:09:43 +01:00
Hannah Wolfe
31ae0c6923 Change RSS content type & use absolute URL in meta
no issue

- changes the content type for the RSS feeds from text/xml to
  application/rss+xml
- changes the link rel=alternate tag to use an absolute URL for the feed
  in the blog meta data
2014-11-24 22:33:49 +00:00
Felix Rieseberg
c7ad09aace Enable :author as permalink option
Closes #3858
- urlPathForPost is now aware of the author’s slug, allowing for the
permalink setting to use :author
- Frontend controller only renders posts that have the specified
author, if one is given
- Extensive tests included
2014-10-25 18:15:24 -07:00
Fabian Becker
aa5cf6ed3b Implements is-helper
closes #2249
- Added context to res.locals
- Added context aware is helper
- Added unit tests
2014-09-23 11:31:16 +02:00
Fabian Becker
c9b0df752f Cleanup reserved words in generateSlug
closes #1889
- Adds a new filter for slugs
- Move slugs to config.slugs
2014-09-18 13:56:51 +02:00
Harry Wolff
469aaa398c Add jscs task to grunt file and clean up files to adhere to jscs rules.
resolves #1920

- updates all files to conform to style settings.
2014-09-17 21:44:29 -04:00
Hannah Wolfe
aa0d9fda46 Merge pull request #4025 from mvalipour/master
URL replacement in RSS feed mucks with content
2014-09-15 20:35:18 +01:00
Mo Valipour
98d0954e32 Fix URL replacement in RSS feed mucking with content
closes #3983
- removed naive regex implementation
- added cheerio to project dependencies
- used cheerio to parse RSS content
- use attribute getter/setter to replace href/src attribute urls with the resolved version
2014-09-13 18:11:07 +01:00
Hannah Wolfe
5faeb2996b Merge pull request #3874 from morficus/issue-3241
adding config flags to control all items mentioned in PRIVACY.md
2014-09-13 17:23:56 +01:00
Maurice Williams
3583515e44 adding config flags to control all items mentioned in PRIVACY.md
closes #3241
- in config.js, the `privacy` attribute holds all privacy-related flags
- `privacy.userTinfoil: true` disables everything (equivalent to setting all flags to false)
- added helper function to core/server/config/index.js to checking privacy flags
- added helper function to core/server/config/index.js to show warning about deprecated items
2014-09-13 12:04:01 -04:00
Chris Pearce
97946cbc14 Ability to create custom template files for custom tags. Eg. tag-design.hbs 2014-09-05 17:35:30 +01:00