Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Added PartialIteration object used when rendering collections #7698
Based on the ideas in #5634 but refactored into an object as per the comments.
The iteration object is available as the local variable
It gives access to the +size+ of the collection beeing iterated over,
For now the "template_name_counter" variable is kept but is deprecated.
+1 for this pull request. Since PartialIteration implements #index, I believe the best solution regarding variable_counter would be to print/log a deprecation warning and remove it in 4.1 or another release. I could try to implement this if you guys want. Also let me know if I can help with anything.
The problem is that getting this functionality with an deprecation warning for the old counter variable is as I see it pretty much impossible without adding (some what hard to follow) code to
When looking at this again I have a hard time feeling the addition is worth hacking
So unless someone have a great idea of how to achieve this maybe we should close this for now
The iteration object is available as the local variable "template_name_iteration" when rendering partials with collections. It gives access to the +size+ of the collection beeing iterated over, the current +index+ and two convinicence methods +first?+ and +last?+ "template_name_counter" variable is kept but is deprecated.
Squash and merge #7698 doing some improvements to the original implementation.