Sha256: e05805e48dde2538ea7eb374c8873393a1611bb5a22abea121daccac38443c44

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

<%= f.label a, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
<%= render 'slash_admin/shared/tooltip', a: a %>
<%= f.select a.to_s,
  options_for_select(class_name_from_association(f.object, a).constantize.all.order(f.object.send(a).present? ? "CASE WHEN id = #{f.object.send(a).try(:id)} THEN 1 ELSE 0 END DESC" : "id DESC").limit(20).collect { |assoc| [assoc.send(object_label(class_name_from_association(f.object, a))), assoc.id] }, f.object.send(a).present? ? f.object.send(a).try(:id) : nil),
  {
   include_blank: true,
  },
  'data-placeholder': t('slash_admin.view.select_model', model_name: class_name_from_association(f.object, a).constantize.model_name.human.downcase),
  'data-model': class_name_from_association(f.object, a).constantize.model_name.to_s.underscore,
  'data-fields': "SlashAdmin::Models::#{class_name_from_association(f.object, a).classify.pluralize}Controller".constantize.new.autocomplete_params.join(' '),
  class: 'form-control select2-model-single',
  required: required?(f.object, a).present?
%>

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
slash_admin-1.5.11 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.10 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.9 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.8 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.7 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.6 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.5 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.4 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.3 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.2 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5.1 app/views/slash_admin/fields/_has_one.html.erb
slash_admin-1.5 app/views/slash_admin/fields/_has_one.html.erb