Sha256: 781521a9d3fc26942433b03d1d8695def8a7bd96fce02898aa3b82bfc20678e9

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

class SunriseTestimonial < Sunrise::AbstractModel
  self.resource_name = 'Testimonial'

  available_index_views [:thumbs]

  index :thumbs do
    scope { Testimonial.includes(:testimonial_pic).recently }
    preview ->(record) { record.image.url(:thumb) }

    field :notes
    field :content
    field :locale
    field :rating
    field :is_visible
    field :published_at
  end

  form do
    field :name
    field :country, as: :string
    field :locale, as: :select, collection: -> { I18n.available_locales }, include_blank: false
    field :notes, as: :string
    field :content, as: :text
    field :published_at
    field :rating, collection: (0..5).to_a, include_blank: false
    field :show_on_pages, as: :select, collection: (lambda do
      Structure.visible.select(&:service_page?) +
        Structure.with_type(StructureType.main) +
        Structure.with_type(StructureType.landing) +
        Structure.with_type(StructureType.company)
    end), input_html: { multiple: true, style: 'width: 100%;' }, html: { style: 'width: 100%;' }
    field :is_visible

    group :bottom, holder: :bottom do
      field :testimonial_pic, as: :uploader
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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