If you convert that into a general tag I can throw that into 
hobo-contrib or maybe even into Rapid itself...

First pass (probably won't even compile):

<def tag="radio-button" attrs="option">
   <%= radio_button_tag(param_name_for_this, option, (option==this), 
attributes) %>
</def>

<def tag="radio-button-item" attrs="option, id">
   <radio-button option="&option" value="&value" id="&id" param />
   <label for="&id" param />
</def>

<def tag="radio-group" attrs="options, labels">
   <% labels ||= [] %>
   <% options.each_with_index do |option, index| -%>
   <radio-button-item option="&option" 
id="#{param_name_for_this}[#{index}]">
     <label:><%= labels[index] || option %></label:>
   </radio-button-item>
</def>

and to use

<def tag="input" for "ArticleStatus">
   <radio-group options="ArticleStatus.values">
</def>

The user would probably want to extend radio-button-item as well....

Bryan

Gert Thiel wrote:
> Hoi.
> 
> I've written something like
> 
> <def tag="input" for="HoboFields::TaxEntitlement" attrs="labels,
> titleize"><%
>   labels ||= {}
>   titleize = true if titleize.nil?
>   options = HoboFields::TaxEntitlement::TAX_ENTITLEMENTS
>   options.each do |o|
> %>
>   <p><%= radio_button_tag(param_name_for_this, o[1], (o[1] == this))
> %> <span><%= o[0] %></span></p>
> <% end %>
> </def>
> 
> for my own rich type HoboFields::TaxEntitlement.
> 
> —Gert
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to