Sha256: d5fe80ddf47f63e016786023bded15b430cb0c6723a34dae237bbdbf2ed6566a

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

<%
  block = properties['options']
  args = properties.except('options')
  collection = block.call(f.object)
  if collection.class.to_s.demodulize == 'ActiveRecord_Relation'
    id_method = :id
    label_method = :name
  else
    id_method = :first
    label_method = :last
  end
  collection = options_from_collection_for_select(
                  collection,
                  id_method,
                  label_method,
                  @resource_instance.send(attribute)
                )
%>
<%= 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

2 entries across 2 versions & 1 rubygems

Version Path
adminpanel-2.5.5 app/views/adminpanel/form/_select.html.erb
adminpanel-2.5.4 app/views/adminpanel/form/_select.html.erb