# 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