Module: Spina::Admin::Conferences::ConferencesHelper
- Defined in:
- app/helpers/spina/admin/conferences/conferences_helper.rb
Overview
Helper for conferences
Constant Summary collapse
- STRUCTURES =
[ { name: 'sponsors', structure_parts: [ { name: 'name', title: 'Name', partable_type: 'Spina::Line' }, { name: 'logo', title: 'Logo', partable_type: 'Spina::Image' }, { name: 'website', title: 'Website', partable_type: 'Spina::Admin::Conferences::UrlPart' } ] } ].freeze
Instance Method Summary collapse
Instance Method Details
#build_custom_structure_parts(name, item) ⇒ Object
26 27 28 29 30 31 |
# File 'app/helpers/spina/admin/conferences/conferences_helper.rb', line 26 def build_custom_structure_parts(name, item) structure = STRUCTURES.find { |structure_attributes| structure_attributes[:name] == name } return item.parts if structure.blank? structure[:structure_parts].map { |part_attributes| build_custom_structure_part(item.parts, part_attributes) } end |
#new_custom_structure_item(form, part) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/spina/admin/conferences/conferences_helper.rb', line 16 def new_custom_structure_item(form, part) item = StructureItem.new build_custom_structure_parts(part.name, item) fields = form.fields_for(:structure_items, item, child_index: item.object_id) do |builder| render('spina/admin/conferences/conferences/form_structure_item', f: builder, structure: part) end link_to icon('plus'), '#', class: %w[add_structure_item_fields button button-link], data: { id: item.object_id, fields: fields.squish } end |