Sha256: 9487eca2549ae8c3eebe6234c7b42bdd2a98c85a4f734a4e1531213879f50f2a

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

module Sunrise
  module StructureHelper
    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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/helpers/sunrise/structure_helper.rb