Sha256: ad511bc516b520b3ff825622cef9a4faba2e3a4cee2dd018659c4a98b6e3de50

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

ruby:
  index ||= false

  if index
    require_locals(['assoc'], local_assigns)
  else
    require_locals(['assoc', 'parent_item'], local_assigns)
  end

  # optional locals
  assoc_name          ||= assoc.to_s                      # 'restaurant_bars'
  title               ||= assoc_name.humanize             # 'Restaurant Bars'
  header              ||= title
  add_button_text     ||= "Add #{title.singularize}"
  ordered             ||= false
  has_thumb           ||= false
  edit_column         ||= false
  cols                ||= []
  helper_text         ||= ''

  # lesser known optional locals, dervived from options by default
  assoc_name_singular ||= assoc_name.singularize          # 'restaurant_bar'
  new_path            ||= "new_#{fae_path}_#{assoc_name_singular}_path"
  edit_path           ||= "edit_#{fae_path}_#{assoc_name_singular}_path"

  options_for_table = { index: index, assoc: assoc, assoc_name: assoc_name, title: title, header: header, add_button_text: add_button_text, ordered: ordered, has_thumb: has_thumb, edit_column: edit_column, cols: cols, assoc_name_singular: assoc_name_singular, new_path: new_path, edit_path: edit_path }
  options_for_table[:parent_item] = parent_item unless index

- if index
  .main_content-section-area
    section.js-addedit-form
      == render 'fae/shared/shared_nested_table', options_for_table

- else
  h2.main_content-section-title = header
  .main_content-section-area
    section.js-addedit-form
      a.js-add-link.table-add-link href=self.send(new_path, item_id: parent_item.id, item_class: parent_item.class.to_s) = add_button_text
      h3 = title
      - if helper_text.present?
        h6.table-helper-text = helper_text
      == render 'fae/application/flash_messages'
      == render 'fae/shared/shared_nested_table', options_for_table

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fae-rails-1.2.4 app/views/fae/shared/_nested_table.html.slim