Sha256: 83473b6833b3397b4ba93b47ea9202e13b8b8497be02527116ef95bb4c00b4ac

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

class SunriseStructure < Sunrise::AbstractModel
  self.resource_name = 'Structure'

  default_index_view :tree
  available_index_views [:tree, :thumbs]

  index :tree do
    field :title
    field :updated_at
    field :id
  end

  show do
    field :title
    field :redirect_url
    field :is_visible
    field :is_update_traking
  end

  form do
    field :title, translate: true
    field :redirect_url
    field :slug
    field :parent_id, collection: -> { Structure.nested_set_options { |i| "#{'–' * i.depth} #{i.title}" } },
                      if: ->(s) { s.moveable? }
    field :structure_type_id, collection: -> { StructureType.all }, include_blank: false
    field :position_type_id, collection: -> { PositionType.all }, include_blank: false
    field :is_visible
    field :is_update_traking

    group :meta_tags, holder: :sidebar do
      field :tag_title, as: :text, input_html: { rows: 2 }, translate: true
      field :tag_keywords, translate: true
      field :tag_description, as: :text, input_html: { rows: 5 }, translate: true
    end

    group :bottom, holder: :bottom do
      nested_attributes :widgets, multiply: true do
        field :title, translate: true
        field :widget_type_id, collection: -> { WidgetType.all },
                               include_blank: false,
                               html: { style: 'width:380px;clear:both;' },
                               input_html: { style: 'width:350px;' }
        field :sort_order, input_html: { style: 'width:50px;' }, html: { style: 'width:100px;' }
        field :counter, input_html: { style: 'width:50px;' }, html: { style: 'width:50px;' }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/sunrise/sunrise_structure.rb