Sha256: 5d94764c4aced222177b4bc762be409417166fed0013b9296f0ca4aebf1a7fda

Contents?: true

Size: 848 Bytes

Versions: 6

Compression:

Stored size: 848 Bytes

Contents

<%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
<%= render 'slash_admin/shared/tooltip', a: a %>
<%= f.collection_select "#{a.to_s.singularize}_ids",
class_name_from_association(f.object, a).constantize.all.order(f.object.send(a).present? ? Arel.sql("CASE WHEN id IN(#{f.object.send(a).pluck(:id).join(',')}) THEN 1 ELSE 0 END DESC") : "id DESC").limit(20), :id,
object_label(class_name_from_association(f.object, a)),
{include_blank: true},
{
  class: 'form-control select2-model-multiple',
  multiple: true,
  '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(' '),
  required: required?(f.object, a)
} %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slash_admin-1.5.11 app/views/slash_admin/fields/_has_many.html.erb
slash_admin-1.5.10 app/views/slash_admin/fields/_has_many.html.erb
slash_admin-1.5.9 app/views/slash_admin/fields/_has_many.html.erb
slash_admin-1.5.8 app/views/slash_admin/fields/_has_many.html.erb
slash_admin-1.5.7 app/views/slash_admin/fields/_has_many.html.erb
slash_admin-1.5.6 app/views/slash_admin/fields/_has_many.html.erb