Module: Sunrise::StructureHelper

Defined in:
app/helpers/sunrise/structure_helper.rb

Instance Method Summary collapse

Instance Method Details

#manage_structure_path(record, _options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/sunrise/structure_helper.rb', line 5

def manage_structure_path(record, _options = {})
  # options = { parent_id: record.id, parent_type: 'Structure' }.merge(options)

  return '' unless record&.structure_type

  case record.structure_type.kind
  when :page, :writers, :group, :main, :services, :prices, :company, :contacts
    edit_path(model_name: :pages, id: record.id)
  when :posts, :questions, :testimonials
    index_path(model_name: record.structure_type.kind)
  when :formats then index_path(model_name: 'format_services')
  else edit_path(model_name: :structures, id: record.id)
  end
end

#show_model_path(_abstract_model, record) ⇒ Object



20
21
22
23
# File 'app/helpers/sunrise/structure_helper.rb', line 20

def show_model_path(_abstract_model, record)
  # model_name = abstract_model.plural.to_sym
  show_path(id: record.id)
end