[WIP] {{#get}}
helper + filter parameter
#5608
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a very rough WIP, featuring 2 individual pieces of work:
{{#get}}
helper, refs Query (get) helper #4439filter
parameter to the API, refs API: Filter parameter (GQL filter queries spec) #5604 - main body of the work is in Initial Commit GQL#2Each piece will eventually be split into 3 complete PRs with full tests. This PR is here so that people can start to see and play with the functionality being added.
If you pull down this PR (tip: this blog post explains how http://dev.ghost.org/easy-git-pr-test/)
You'll be able to start playing with the get helper in your themes.
Evolving documentation exists on the get helper issue: #4439 but the basics are as follows:
{{#get}}{{/get}}
is a block helper, so it has opening and closing tags and supports else.include
,limit
orfilter
to modify the queryget
you can loop over the resources you've fetched using foreachHere's an example:
The main things which are not working yet (off the top of my head) are advanced joins from users and tags, filtering based on dates, pages behaviour needs to be fixed by #5151 and please also note that there is no
order
parameter yet #5602.Have fun and leave lots of feedback please!