Sha256: df9c44a9d505bb80a503ca3b2374a32b01ffa4e2f7e20171bcc4bcf4f1ecb5d6

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

<%= f.label a, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
<%= render 'slash_admin/shared/tooltip', a: a %>
<%= f.collection_select a.to_s + '_id',
                        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), :id, object_label(class_name_from_association(f.object, a)),
                        {
                          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

6 entries across 6 versions & 1 rubygems

Version Path
slash_admin-1.4.1 app/views/slash_admin/fields/_belongs_to.html.erb
slash_admin-1.4 app/views/slash_admin/fields/_belongs_to.html.erb
slash_admin-1.3.5 app/views/slash_admin/fields/_belongs_to.html.erb
slash_admin-1.3.4 app/views/slash_admin/fields/_belongs_to.html.erb
slash_admin-1.3.3 app/views/slash_admin/fields/_belongs_to.html.erb
slash_admin-1.3.2 app/views/slash_admin/fields/_belongs_to.html.erb