IMO, the best solution is to cut and paste the collection definition
from rapid_generics.dryml into your application.dryml, and then change
the 'ul' into an 'ol'. This won't any other part of your application
until you update your CSS since the Hobo theme hides list markers
anyways.
For that reason we should consider making the same change in Hobo
itself for everybody.
Another option would be:
<def tag="collection" attrs="list-tag">
<% list_tag ||= 'ul' %>
<call-tag tag="&list_tag" class="collection #{collection_name
:dasherize => true}" merge-attrs unless="empty?">
<li param="item" class="#{scope.even_odd} #{model_id_class}"
repeat="&select_viewable">
<do param="default"><card param/></do>
</li>
</call-tag>
<empty-collection-message param="empty-message"/>
</def>
which would allow you to do:
<collection: list-tag='ol'> in your page. However, I think the first
option I mentioned is best. Does anybody have any objections to
changing the collection list tag to 'ol'?
Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/Z_3Vzpj_HRcJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
That wouldn't do much good -- the only two things that are ever passed
to a collection are plain old lists and ActiveRecord finders. The
list itself can contain many different types of objects: the
live-search is a good example of that in action.
Bryan
Besides the update discussed, it has been updated to work better with
non-ActiveRecord arrays.
Bryan
<!-- Repeats the body of the tag inside a `<ul>` list with one item
for each object in the collection (`this`). If no body is given,
renders a `<card>` inside the `<li>`.
Automatically adds 'even' and 'odd' CSS classes.
`empty-collection-message` is called from this tag. To suppress you
can use the `without-empty-message` pseudo-attribute:
<collection without-empty-message/>
If your collection is an ActiveRecord result set (and in Hobo it most
likely is), the best way to customize the empty message is via
translations. Example: for product models, the key to customize
would be `products.collection.empty_message`.
If your collection is a generic array, empty-collection-message
doesn't work. `<collection>` also sets the last_if flag, so you can
use the `<else>` tag to display a message:
<collection with="&[]"/> <else>No items.</else>
### Attributes
- list-tag: set to 'ol' if you prefer that over 'ul'. --><def
tag="collection" attrs="list-tag"> <% list_tag ||= 'ul' %> <call-tag
tag="&list_tag" class="collection #{collection_name :dasherize =>
true}" merge-attrs unless="empty?"> <li param="item"
class="#{scope.even_odd} #{model_id_class}" repeat="&select_viewable">
<do param="default"><card param/></do> </li> </call-tag>
<empty-collection-message param="empty-message"/> <if/><%# set
last-if so <else/> works %></def>
<!-- Renders a message such as "No products to display". If the
collection (`this`) is empty, `style="display:none"` is added. This
means the message is still present and can be revealed with JavaScript
if all items in the collection are removed via ajax remove buttons.
--><def tag="empty-collection-message"> <unless
test="&this._?.member_class.nil?"> <div
class="empty-collection-message" style="#{'display:none' if
!this.empty?}" param="default"> <ht
key="#{this.member_class.name.underscore}.collection.empty_message">
No <collection-name/> to display </ht> </div>
</unless></def>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/T3ypw4DMVVsJ.
Is there anybody who would like to volunteer to do this? Expertise is
not required, so it's a great way to get yourself into the list of
people who have patches accepted into Hobo. :)
cheers,
Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/-W4_Uo15YHQJ.