No commit activity in last 3 years
No release in over 3 years
Adds the ability to iterate over a page's children per n items.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.9.1
 Project Readme

Group Children

This is an extension for Radiant, put together by jomz

Sometimes you want to iterate over a list of children, and insert something after every n-th child. Or, for css reasons you want to group children per 3. Until now we have sometimes used javascript to alter markup, which is very ucky..

Here is the solution;

<r:children:grouped size="3">
  <div>
    <r:children:each> ... </r:children:each>
  </div>
</r:children:grouped>

The children:grouped tag takes all the same arguments like children:each, except for pagination. Furthermore, inside children:grouped, you can use r:if_first and r:if_last to check if you are in the first or last group. The children:each within children:grouped does NOT take arguments; those have to be passed to the children:grouped tag itself.

This extension does not override any of the existing tags, and should be backwards-compatible with 0.8 and earlier.

Installation

Clone or submodule this extension into vendor/extensions/group_children Or, gem install radiant-group_children-extension and put this inside Radiant::Initializer;

config.gem 'radiant-group_children-extension', :lib => false