-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[suggestion] collection counter #392
Comments
In 4.1, this is implemented: https://github.com/apotonick/cells/blob/4d39f994e6dd288367e75d30cec2d30ac7e1aec6/test/public_test.rb#L70 Is that cool? |
so |
ok, how is this supposed to look like in an erb template? <%= cell('item', collection: @item).join do |cell, index| %>
<% cell.(:show, first_call: index.zero?) %>
<% end.html_safe %> Am I doing this right? Looks not particularly nice, especially because of the need of |
The |
Uhm, that gem does not exist yet, does it? Other than that, would be nice if index was merged into options, passed to |
We actually thought of a "collection context object". We could totally do that, that's not really magic. |
👍 |
Similar to rails providing
item_counter
variable forrender partial: 'blah', collection: items
, index could be passed as a parameter for cell method. This simplifies things for something (say javascripts) that has to be rendered only once for entire collectionCell::Collection#call
almost has it, just needs to pass that index furtherThe text was updated successfully, but these errors were encountered: