Sha256: 0c007eaebfe906e86a1e86605a704df61921da7c8ac8094cb8cf05baf4f47daa

Contents?: true

Size: 1.16 KB

Versions: 23

Compression:

Stored size: 1.16 KB

Contents

<%
  block = properties['options']
  args = properties.except('options')
  collection = block.call(@resource_instance)
  if collection.class.to_s.demodulize == 'ActiveRecord_Relation'
    id_method = :id
    label_method = :name
  else
    # collection is an array of arrays:
    # [
    #   [123, value],
    #   [456, value]
    #   ...
    # ]
    id_method = :first
    label_method = :last
  end
%>
<div class="control-group">
  <div class="control-label">
    <%= properties['label'] %>
  </div>
  <%= hidden_field_tag("#{class_name_downcase(f.object)}[#{relationship_ids(properties["model"])}][]", nil) %>
  <div class="controls" id="<%= attribute.gsub('_ids', '') %>-relation">
    <%= f.collection_check_boxes(
          attribute,
          collection,
          id_method,
          label_method
    ) %>
  </div>
</div>

<% if !is_modal &&
  (
    properties['remote_resource'].nil? ||
    properties['remote_resource']
  ) %>
  <!-- if not making resource from other form so we don't have to manage
  infinite nested forms and relations -->
  <%= render(
      'adminpanel/shared/create_remote_resource_button',
      remote_model: attribute.gsub('_ids', '')
  ) %>
<% end %>

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
adminpanel-3.6.1 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.6.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.5.1 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.5.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.7 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.6 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.5 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.4 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.3 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.2 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.1 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.4.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.3.4 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.3.3 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.3.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.2.1 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.2.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.1.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-3.0.0 app/views/adminpanel/form/_checkbox.html.erb
adminpanel-2.6.1 app/views/adminpanel/form/_checkbox.html.erb