Sha256: a5218a4affc7144297ba30479ce15bb0c8c2ff6388b3477cd46bb205df4a4255

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

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,
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] },
{
  prompt: 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: 'selectize-model-single', required: required?(f.object, a).present? %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slash_admin-1.0.6 app/views/slash_admin/fields/_has_one.html.erb