Module: Crm::ExportedCatalogItemPacketsHelper

Defined in:
app/helpers/crm/exported_catalog_item_packets_helper.rb

Overview

View helpers for the exported catalog item packet screens.

Instance Method Summary collapse

Instance Method Details

#exported_packet_edit_tab_options(f) ⇒ Hash{Symbol => Hash}

Builds the editable tab options for an exported catalog item packet form.

Parameters:

  • f (ActionView::Helpers::FormBuilder)

    form builder for the packet,
    passed through to each tab partial as locals[:f]

Returns:

  • (Hash{Symbol => Hash})

    tab definitions keyed by tab name, each with
    an optional :counter, :partial, and :locals



28
29
30
31
32
33
34
35
36
37
# File 'app/helpers/crm/exported_catalog_item_packets_helper.rb', line 28

def exported_packet_edit_tab_options(f)
  {
    packet_details: { partial: 'edit_packet_details', locals: { f: f } },
    attributes: { counter: @attributes.size, partial: 'edit_attributes', locals: { f: f } },
    items: { counter: @exported_catalog_items.size, partial: 'edit_catalog_items', locals: { f: f } },
    images: { partial: 'edit_item_images', locals: { f: f } },
    literature: { partial: 'edit_literature', locals: { f: f } },
    att_order: { partial: 'edit_attribute_order', locals: { f: f } }
  }
end

#exported_packet_tab_optionsHash{Symbol => Hash}

Builds the read-only tab options for an exported catalog item packet.

Returns:

  • (Hash{Symbol => Hash})

    tab definitions keyed by tab name, each with
    an optional :counter, :title, and :remote_href



11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/crm/exported_catalog_item_packets_helper.rb', line 11

def exported_packet_tab_options
  {
    attributes: { counter: @attributes.size, remote_href: tab_attributes_exported_catalog_item_packet_path(@packet) },
    items: { counter: @exported_catalog_items.size, remote_href: tab_items_exported_catalog_item_packet_path(@packet) },
    images: { remote_href: tab_images_exported_catalog_item_packet_path(@packet) },
    literature: { remote_href: tab_literature_exported_catalog_item_packet_path(@packet) },
    uploads: { counter: @packet.uploads.size, remote_href: tab_uploads_exported_catalog_item_packet_path(@packet) },
    history: { title: "Transmit History", remote_href: tab_history_exported_catalog_item_packet_path(@packet) }
  }
end