Plugin or Helper?
Closed this issue · 2 comments
@jonschlinkert Should this be a plugin or helper?
If we go with helper, I think this is how it would work...
- some index.hbs page manually created by user/designer
Then I think the pager helper will output some html and javascript to make the paging done inline.
If we go with the plugin, then I think it would have an index option that we would use to build index pages and create one for each set of pages/posts and pass in the current pagination object so the user/designer could do whatever they want.
First, here is the data we need:
Pagination
- index
- total pages
- current page
- first page
- last page
- next page
- previous page
Page of pages
- context for each page in the target
- content for each page in the target
Good use cases to think about for the "page of pages":
- A list of full posts, one after another
- A list of post "summaries", which would either require truncating the content (via a helper like
{{truncate}}), or require a property in the context that has a summary of the content. - A list of UI components
Ideally, both context and content would be available both raw and processed, allowing plugin/helper authors to use that data however they want.
Also, let's avoid using generic variables for built-ins, like {{list}}, that will break someone's stuff. That's why I used "compose"
Oh, and regarding whether it's a helper or plugin, I think it might make sense to do both bundled together in one project... where the plugin takes care of making sure that the correct context is supplied to the helper, etc.