Commit Graph

5950 Commits

Author SHA1 Message Date
Hannah Wolfe
9eadeb9fbb Prep shared API URL util for use on external sites
refs #5942, #6150

There were a few key problems I was looking to solve with this:

- Introduce a single point of truth for what the URL for accessing the API should be
- Provide a simple way to configure the utility (much like a true SDK)

As of this commit, this utility is still automatically available in a Ghost theme.
To use it on an external site, the code would look like:

```
<script type="text/javascript" src="http://my-ghost-blog.com/shared/ghost-url.min.js"></script>
<script type="text/javascript">
ghost.init({
   clientId: "<your-client-id>",
   clientSecret: "<your-client-secret>"
});
</script>
```

To achieve this, there have been a number of changes:

- A new `apiUrl` function has been added to config, which calculates the correct URL. This needs to be unified with the other url generation functions as a separate piece of work.
- The serveSharedFile middleware has been updated, so that it can serve files from / or /shared and to substitute `{{api-url}}` as it does `{{blog-url}}`.
- ghost-url.js and ghost-url.min.js have been updated to be served via the serveSharedFile middleware
- ghost-url.js has been changed slightly, to take the url from an inline variable which is substituted the first time it is served
- `{{ghost_head}}` has been updated, removing the api url handling which is now in config/url.js and removing the configuration of the utility in favour of calling `init()` after the script is required
- `{{ghost_head}}` has also had the meta tags for client id and secret removed
- tests have been updated
2015-12-15 11:50:46 +00:00
Hannah Wolfe
7fea696d21 Merge pull request #6213 from cobbspur/getPaginationFix
Ensure {{get}} helper returns pagination
2015-12-15 11:20:42 +00:00
Sebastian Gierlinger
9eb065dde3 Merge pull request #6217 from ErisDS/fix-config-in-tests
Unify usage of config in unit tests
2015-12-15 12:16:48 +01:00
Hannah Wolfe
bc97de5fe9 Unify usage of config in unit tests
no issue

- provide a single point for accessing config in unit tests
- create a single way to set and restore config
- ensure that restore deletes top level optional keys that are now undefined
- use this._config in check deprecations, otherwise the config gets cached
- solves issues with interdependent tests
2015-12-15 10:48:24 +00:00
Sebastian Gierlinger
432f8610c8 Merge pull request #6220 from ErisDS/issue-6205-limit
Add `limit` attribute to tags & foreach helpers
2015-12-15 11:37:44 +01:00
Sebastian Gierlinger
69ccca2cca Merge pull request #6167 from ErisDS/perma-ppp
Moving 'permalinks' and 'postsPerPage' to config.theme cache
2015-12-15 11:35:46 +01:00
Sebastian Gierlinger
e5ca7258d1 Merge pull request #6214 from ErisDS/auth-errors
Improvements to client auth error logging
2015-12-15 11:31:55 +01:00
Hannah Wolfe
a27f22acf5 Add limit attribute to tags & foreach helpers
refs #6205

- limit attribute allows theme developers to restrict output from these helpers to a smaller number
than would usually be output
2015-12-15 10:05:25 +00:00
Hannah Wolfe
883152ff15 Improvements to client auth error logging
no issue

- If client credentials are missing, or not valid, output a clear message in the server console
- Still defaults to sending the 'access denied to url' error to the frontend
2015-12-15 08:29:44 +00:00
Hannah Wolfe
e84b7f3217 Cache permalinks & postsPerPage on config.theme
no issue

- Cache the permalinks & postsPerPage settings on the config.theme object
- Use the config.theme cache to reference these items throughout the frontend of a blog
- Removes the need for workarounds and extra code to handle async fetches
- Makes these values accessible to all themes, which is very useful now we have the API stuff
2015-12-15 08:16:53 +00:00
cobbspur
0ce4078f45 Ensure {{get}} helper returns pagination
No Issue

- pagination returned if meta pagination exists
- needed to allow pagination helper to work
2015-12-14 13:27:07 +00:00
Hannah Wolfe
cc3b9e9f53 Merge pull request #6200 from kevinansfield/reset-tags-scope-on-deactivate
Reset shortcuts scope when leaving tags route
2015-12-10 18:41:23 +00:00
Kevin P. Kucharczyk
ff2711af30 Fix hidden delete button in image uploader for short images
closes #6194
- removed min-height animation from image uploader
2015-12-10 18:45:46 +01:00
Hannah Wolfe
2b145b3c61 Merge pull request #6202 from acburdine/ghost-url-updates
`ghost.url.api` cleanup/minification
2015-12-10 17:21:14 +00:00
Sebastian Gierlinger
bbbcf4f57e Merge pull request #6203 from ErisDS/no-soft-404s
No more soft 404s in pagination
2015-12-10 18:00:31 +01:00
Hannah Wolfe
a4b3bb79a5 Merge pull request #6184 from kevinansfield/fix-date-input
Fix changing text and jumping caret in PSM's date input
2015-12-10 16:29:36 +00:00
Hannah Wolfe
cbe9ee1cd1 Merge pull request #6181 from kevinansfield/fix-404-handler
Prevent 404-handler mixin from erroring on non-adapter errors
2015-12-10 16:26:07 +00:00
Hannah Wolfe
8c355349b3 No more soft 404s in pagination
closes #6201

- redirects for page/1/ or rss/1/ are now 301s
- any other invalid page now 404s
2015-12-10 15:00:02 +00:00
Austin Burdine
8f89997deb minify ghost.url.api in production
closes #6150
- clean up ghost.url.api script
- switch to inlining config and making the ghost-url.js file an external request
- add minification in production
2015-12-10 08:46:58 -06:00
Kevin Ansfield
78240e186b Reset shortcuts scope when leaving tags route
refs #6191, #6192
- adds additional safeguard to tags route to ensure keymaster scope doesn't get stuck in a non-default scope that may break shortcuts elsewhere
2015-12-10 12:27:48 +00:00
Hannah Wolfe
70a481be32 Merge pull request #6153 from kevinansfield/fix-subdir-nav-issues
Fix sub-dir being added to navigation urls when installed in sub-dir
2015-12-09 21:27:43 +00:00
Hannah Wolfe
16c71dde22 Merge pull request #6032 from vdemedes/pipeline-mail
Refactor mail API with pipeline utility
2015-12-09 19:28:08 +00:00
Hannah Wolfe
c27a48ff77 Merge pull request #6144 from acburdine/add-istanbul
Add istanbul peer dependency
2015-12-09 17:37:16 +00:00
Austin Burdine
c6ed823201 deps: istanbul@0.4.1 2015-12-09 09:43:21 -06:00
Sebastian Gierlinger
271dad4382 Merge pull request #6188 from ErisDS/deasync-helpers
Remove filters from theme helpers (no async)
2015-12-09 13:33:51 +01:00
Hannah Wolfe
88065f58a0 Remove filters from theme helpers (no async)
closes #5850

- filters were added so that apps could change the output of the helpers, but as async helpers are a hack, this led to issues
- apps aren't currently a working part of Ghost, so for now, lets remove the filters
- we'll add these back when we have a better implementation of async helpers & this style of app is back on the cards
2015-12-08 14:35:04 +00:00
Sebastian Gierlinger
2b926f55a1 Merge pull request #6185 from ErisDS/unidecode
deps: unidecode@0.1.8
2015-12-08 12:25:11 +01:00
Hannah Wolfe
494245ff20 deps: unidecode@0.1.8
closes #6163
2015-12-08 11:01:58 +00:00
Kevin Ansfield
b858232369 Fix changing text and jumping caret in PSM's date input
refs #5777
- adds new `gh-datetime-input` that takes a one-way-bound value and formats it, only triggering the supplied `update` action on focus-out
- fixes bug in PSM's `setPublishedAt` action if model's `published_at` is a Date object not a Moment object
2015-12-08 10:13:17 +00:00
Sebastian Gierlinger
4524898cfc Merge pull request #6182 from ErisDS/channel-config-dynamic
Make channel config dynamic
2015-12-07 22:25:37 +01:00
Hannah Wolfe
a956d595f2 Make channel config dynamic
refs #5091, #6166

- fetch channel config via an internal function
- prevents channel config from being statically cached at runtime
- means that labs & other settings can be used to change these values
2015-12-07 20:06:35 +00:00
Kevin Ansfield
d989933b5c Prevent 404-handler mixin from erroring on non-adapter errors
no issue
- add a check for existence of `error.errors` as that won't be present on non-404 errors - fixes non-404 errors such as "no action handled x" being hidden by a completely different error
2015-12-07 18:37:35 +00:00
Kevin Ansfield
adfad93242 Merge pull request #6178 from syaiful6/select-native
Fix Select Component
2015-12-07 10:40:40 +00:00
Syaiful Bahri
b5a8ac3a7d Fix Select Component
jQuery instance isn't iterable, so we cant destructuring it.

closes https://github.com/TryGhost/Ghost/issues/6171
2015-12-07 16:44:54 +07:00
Kevin Ansfield
a9c952d134 Merge pull request #6100 from acburdine/all-the-tests
Team Acceptance Test
2015-12-07 09:03:46 +00:00
Austin Burdine
c8ac5f37e8 add team acceptance test 2015-12-06 15:24:06 -06:00
Hannah Wolfe
22e3c54ed1 Merge pull request #6174 from cruikshj/master
fixing 'undefined is not a function' error when loading apps
2015-12-06 09:34:53 +00:00
Sebastian Gierlinger
1858bbd55e Merge pull request #6173 from ErisDS/gruntfilefix
Streamline when grunt init is called in tests
2015-12-05 11:30:24 +01:00
John Cruikshank
5e6ed119fa fixing 'undefined is not a function' error when loading apps 2015-12-04 23:00:37 -06:00
Hannah Wolfe
739c7d36ed Streamline when grunt init is called in tests
- test-server only needs submodules to be updated
2015-12-04 19:53:50 +00:00
Hannah Wolfe
ef53b1bf00 Merge pull request #6161 from kevinansfield/jscs-deps
deps: jscs@2.6.0 & ember-suave@1.2.3
2015-12-04 10:33:19 +00:00
Kevin Ansfield
cc1fbd44cb Merge pull request #6098 from acburdine/tag-404
Fix 404 error handling in editor, tags, and team routes
2015-12-04 10:20:22 +00:00
Kevin Ansfield
dbf6b59866 deps: grunt-jscs@2.4.0 2015-12-04 10:12:16 +00:00
Kevin Ansfield
4a32098b64 Install client dependencies when running TEST_SUITE=lint build
refs #6161
- run the client initialization tasks as part of the `TEST_SUITE=lint` to fix problems with missing `ember-suave` jscs preset
2015-12-04 09:58:03 +00:00
Kevin Ansfield
d9d8446f02 deps: jscs@2.6.0 & ember-suave@1.2.3
no issue
- fixes an error that popped up after ember-suave's `brocolli-jscs` dependency moved to `2.6.0` which duplicated some of the rules that `ember-suave` used to implement
2015-12-04 09:58:03 +00:00
Austin Burdine
9f827204df fix 404 error handling in editor, tags, and team routes
closes #6094
- adds 404-handler mixin
- applies mixin to settings/tags/tag, editor/edit and team/user routes
- adds adapter-error test helper to override the default adapter error
2015-12-03 16:37:23 -06:00
Sebastian Gierlinger
67c93cb90d Merge pull request #6168 from ErisDS/labs-sync
Change server-side labs utility to be synchronous
2015-12-03 21:25:53 +01:00
Hannah Wolfe
4bfacf6b86 Change server-side labs utility to be synchronous
refs #6165

- Use the settings cache to populate config.labs whenever settings change
- Use the labs util just to check if a flag isSet synchronously
2015-12-03 16:05:50 +00:00
Hannah Wolfe
ea8533842d Merge pull request #6122 from kevinansfield/slug-query-with-include
Add count.posts support to user model on client
2015-12-03 14:48:21 +00:00
Gary Cao
75845ce4af Checkbox labels are cut off on mobile.
closes #6089
2015-12-02 18:28:50 +09:00