Sha256: b1ac12143e9e0a6f425d34455d1af32b59f8448d34b2f6c1b4c1d95a3bf7b492

Contents?: true

Size: 1.5 KB

Versions: 21

Compression:

Stored size: 1.5 KB

Contents

- data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
- fk = field.db_name
.node
  .label= f.label fk, reflection_title(f, field, 1)
  .input.select_input.quick_edit_block
    - if field.link
      .quick_edit_template{type: 'text/template'}
        = options_for_select([['{to_bhf_s}', '{object_id}', {data: {edit: edit_entry_path(field.link.name, '{object_id}'), delete: entry_path(field.link.name, '{object_id}')}}]])
      - select_options ||= options_from_collection_for_select_with_html_attrs(data_source, :id, :to_bhf_s, f.object.send(fk), Proc.new {|obj| {data: {edit: edit_entry_path(field.link.name, obj), delete: entry_path(field.link.name, obj)}}})
    - else
      - select_options ||= options_from_collection_for_select(data_source, :id, :to_bhf_s, f.object.send(fk))

    = f.select fk, select_options, {include_blank: true}, {class: ('quick_edit_inject quick_edit_select' if field.link)}
    = render partial: 'bhf/helper/field_errors', locals: {f: f, field: fk}

    - if field.link && ! field.link.hide_edit
      = link_to edit_t(field.link), '', class: 'js_edit_field icon edit quick_edit'
    - if field.link && ! field.link.hide_delete
      = link_to '×'.html_safe, '', method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
    - if field.link && ! field.link.hide_create
      = link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit'

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
bhf-0.10.13 app/views/bhf/form/belongs_to/_select.html.haml