Sha256: 5cc0c0e592eab6548ec99d9f0546fdd0872ba4b0e286bdafc532a4d4456437a3

Contents?: true

Size: 1.89 KB

Versions: 8

Compression:

Stored size: 1.89 KB

Contents

ActiveAdmin.register C80Catoffers::Offer, as: 'Offer' do

  config.per_page = 100

  menu :label => 'Список услуг', # TODO_MY:: название пункта меню перенесести в параметры в базу
       priority: 2,
       parent: 'Услуги'# TODO_MY:: название пункта меню перенесести в параметры в базу

  permit_params :title,
                :price,
                :short_desc,
                :desc,
                :ophotos_attributes => [:id, :image, :_destroy],
                :prop_ids => [],
                :category_ids => []

  batch_action :destroy, false

  config.sort_order = 'id_asc'

  # before_filter :skip_sidebar!, :only => :index

  index do
    selectable_column
    column :title
    column :price
    column :short_desc
    column :ophoto do |offer|
      if offer.ophotos.count > 0
        link_to image_tag(offer.ophotos.first.image.thumb_preview, style: 'width:150px;'), offer.ophotos.first.image.url, target: '_blank'
      end
    end
    # column :desc do |offer|
    #   offer.desc.html_safe if offer.desc.present?
    # end
    actions
  end

  form(:html => {:multipart => true}) do |f|

    f.inputs 'Свойства' do

      f.input :title
      f.input :categories,
              :as => :select,
              :include_blank => true,
              :input_html => {
                  :class => 'selectpicker',
                  'data-size' => "10",
                  'data-width' => '400px',
                  :multiple => false
              }

      f.input :price
      f.input :short_desc
      f.input :desc, :as => :ckeditor, input_html: {:ckeditor => {:height => 410}}

      f.has_many :ophotos, :allow_destroy => true do |gp|
        gp.input :image,
                 :as => :file,
                 :hint => image_tag(gp.object.image.thumb_preview)
      end

    end

    f.actions
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
c80_catoffers-0.1.0.8 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.7 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.6 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.5 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.4 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.3 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.2 app/admin/c80_catoffers/offers.rb
c80_catoffers-0.1.0.1 app/admin/c80_catoffers/offers.rb