Sha256: 110ab0233e31a28331919c7506c2cc950c81fde1471d810a36436112c0314bd9

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

<%
  block = properties['options']
  args = properties.except('options')
  collection = block.call(f.object)
  if collection.class.to_s.demodulize == 'ActiveRecord_Relation'
    properties['id_method'] ||= :id
    properties['name_method'] ||= :name
    collection = options_from_collection_for_select(
                    collection,
                    properties['id_method'],
                    properties['name_method'],
                    @resource_instance.send(attribute)
                  )

  elsif ['Hash', 'Array', 'HashWithIndifferentAccess'].include? collection.class.to_s.demodulize
    collection = options_for_select(collection)
  end
%>
<%= f.select attribute, collection, { include_blank: true }, args  %>

<% if !is_modal &&
  (
    properties['remote_resource'].nil? ||
    properties['remote_resource']
  ) %>
  <!-- if rendering the form inside a modal, so we don't have to
  manage infinited nested forms and if it's supposed to be
  created in relation model -->

  <%= render(
      'adminpanel/shared/create_remote_resource_button',
      belongs_request: true,
      remote_model: attribute.gsub('_id', '')
  ) %>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adminpanel-3.2.1 app/views/adminpanel/form/_select.html.erb
adminpanel-3.2.0 app/views/adminpanel/form/_select.html.erb
adminpanel-3.1.0 app/views/adminpanel/form/_select.html.erb
adminpanel-3.0.0 app/views/adminpanel/form/_select.html.erb
adminpanel-2.6.1 app/views/adminpanel/form/_select.html.erb
adminpanel-2.6.0 app/views/adminpanel/form/_select.html.erb