Sha256: b64fce52deb3bb0469ac169d3a9d47f4b506afd4c80eff601a80ed62d5a8db25

Contents?: true

Size: 1.38 KB

Versions: 33

Compression:

Stored size: 1.38 KB

Contents

<!-- A simple wrapper around the `<select>` tag and `options_for_select` helper

  ### Attributes

 - `options` - an array of options suitable to be passed to the Rails `options_for_select` helper.
 - `selected` - the value (from the `options` array) that should be initially selected. Defaults to `this`
 - `first-option` - a string to be used for an extra option in the first position. E.g. "Please choose..."
 - `first-value` - the value to be used with the `first-option`. Typically not used, meaning the option has a blank value.
 - `key` - the key used to lookup in the locale file or 'default' by default. If you pass it hobo will lookup in the namespace "tags.select_menu.#{key}" in order to find `options`, `first_option` and `first_value`. The passed attributes are used as a default in case the lookups fail. (see the documentation of filter-menu tag for a similar example).
 -->
<def tag="select-menu" attrs="options, selected, first-option, first-value, key">
<% key ||= 'default'
   %w[options first_option first_value].each do |a|
     str = t("tags.select_menu.#{key}.#{a}", :default=>'')
     eval "#{a} = str unless str.blank?"
   end
-%>
  <select merge-attrs param="default">
    <% selected=this if selected.nil? %>
    <option value="#{first_value}" unless="&first_option.nil?"><first-option/></option>
    <do param="options"><%= options_for_select(options, selected) %></do>
  </select>
</def>

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
hobo_rapid-2.2.6 taglibs/inputs/select_menu.dryml
hobo_rapid-2.2.5 taglibs/inputs/select_menu.dryml
hobo_rapid-2.2.4 taglibs/inputs/select_menu.dryml
hobo_rapid-2.2.3 taglibs/inputs/select_menu.dryml
hobo_rapid-2.2.2 taglibs/inputs/select_menu.dryml
hobo_rapid-2.2.1 taglibs/inputs/select_menu.dryml
hobo_rapid-2.2.0 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.2 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.1 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.0 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.0.pre4 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.0.pre3 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.0.pre2 taglibs/inputs/select_menu.dryml
hobo_rapid-2.1.0.pre1 taglibs/inputs/select_menu.dryml
hobo_rapid-2.0.1 taglibs/inputs/select_menu.dryml
hobo_rapid-2.0.0 taglibs/inputs/select_menu.dryml
hobo_rapid-2.0.0.pre10 taglibs/inputs/select_menu.dryml
hobo_rapid-2.0.0.pre9 taglibs/inputs/select_menu.dryml
hobo_rapid-2.0.0.pre8 taglibs/inputs/select_menu.dryml
hobo_rapid-2.0.0.pre7 taglibs/inputs/select_menu.dryml