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

Version Path
c80_yax-0.1.0.25 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.24 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.23 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.22 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.21 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.20 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.18 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.17 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.16 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.15 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.14 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.13 engines/of/app/admin/ti/offers.rb
c80_yax-0.1.0.12 engines/of/app/admin/ti/offers.rb