Sha256: ac1219f5e0b0af3294880e0b91f7adae74c6c3f45b292ef970f0190348879de4

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

<!-- Renders a `<ul>` list of checkboxes, one for each of the potential targt in a `has_many` association. The user can check the items they wish to have associated. A typical use might be selecting categories for a blog post.

### Attributes

 - `options` - an array of models that may be added to the collection
 - `disabled` - if true, sets the disabled flag on all check boxes.

  -->
<def tag="check-many" attrs="options, disabled"><%
  collection = this
  param_name = param_name_for_this
  options ||= \
    this_field_reflection.klass.all.merge(this_field_reflection.scope).limit(100).select {|x| can_view?(x)}
  -%>
  <ul class="check-many" param="default" merge-attrs>
    <input type="hidden" name="#{param_name}[]" value=""/><% # ensure all items are removed when nothing checked
    %>
    <li repeat="&options" param>
      <input id="#{dom_id(this, :check_many)}" type="checkbox" name="#{param_name}[]" value="@#{this.id}" checked="&this.in?(collection)" disabled="&disabled"/>
      <label for="#{dom_id(this, :check_many)}"><name param/></label>
    </li>
  </ul>
</def>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hobo_rapid-2.2.6 taglibs/inputs/check_many.dryml
hobo_rapid-2.2.5 taglibs/inputs/check_many.dryml
hobo_rapid-2.2.4 taglibs/inputs/check_many.dryml
hobo_rapid-2.2.3 taglibs/inputs/check_many.dryml
hobo_rapid-2.2.2 taglibs/inputs/check_many.dryml
hobo_rapid-2.2.1 taglibs/inputs/check_many.dryml
hobo_rapid-2.2.0 taglibs/inputs/check_many.dryml
hobo_rapid-2.1.2 taglibs/inputs/check_many.dryml