Sha256: 7ee951263e5372a3ca8bfc7b2fe5935ad8273cf653d1d59ba0b84fb7a5d89843
Contents?: true
Size: 1.52 KB
Versions: 13
Compression:
Stored size: 1.52 KB
Contents
ActiveAdmin.register Of::Offer, :as => 'Offer' do before_filter :skip_sidebar!, :only => :index menu :label => 'Акции', :parent => 'x_c80_yax', :priority => 10 permit_params :title, :desc, :item_ids => [], :ophotos_attributes => [:id,:image,:_destroy] index do selectable_column id_column column :title column '' do |offer| if offer.ophotos.count > 0 image_tag(offer.ophotos.first.image.thumb_sm) end end column :desc do |offer| res = '-' if offer.desc.present? res = "#{offer.desc[0..30]}..." end res end actions end form(:html => {:multipart => true}) do |f| f.inputs 'Свойства' do f.input :title f.input :items, :as => :select, :input_html => { :title => '', :class => 'selectpicker', :data => { :size => 10, :width => '700px' }, :multiple => true }, :include_blank => true f.inputs 'Фото' do f.has_many :ophotos, :allow_destroy => true do |ophoto| ophoto.input :image, :as => :file, :hint => image_tag(ophoto.object.image.thumb_sm) end end f.input :desc, :as => :ckeditor, :input_html => {:style => 'height:500px', rows: 20} end f.actions end end
Version data entries
13 entries across 13 versions & 1 rubygems