loop through the elements of the current list |
|
| see add, draggable, drop, each_group, edit, form, zena 1.0 | |
Display
Display a list of links separated by a comma:
<ul do='projects'><li do='each' join=', '><r:link/></li>
Display a list of comments with stripes (alternating class):
<ul do='comments'>
<li do='each' class='comment' alt_class='stripe' do='zazen' attr='text'>sample comment text</li>
</ul>
The example above will generate html code such as this:
<ul>
<li class='comment'>...</li>
<li class='comment stripe'>...</li>
<li class='comment'>...</li>
...
</ul>
If your list fills on top (last element on top), you should use alt_reverse='true' so that inserting new elements does not change the stripes of the existing elements.
Documentation to rewrite
<ul do='notes'>
<li do='each' draggable='true' do='link'/>
<li do='add'/>
</ul>
This method also constructs the form needed to edit the elements of the list if the list contains an edit or an add but no form as in the last example above.
If you set draggable to “true”, the element can be used with drop. It is usually better to use a drag handle instead of the whole element or your users will have troubles clicking links. To do so, simply add drag_handle='true' and zena will insert a span at the start of the element. You can also insert your own element (default class is ‘drag_handle’).
You have to escape html in the join parameter by using < and >.
The “stripe” example above will give the following html:
<li class='note'>...</li>
<li class='note stripe'>...</li>