Sha256: c4c00a67665033147b45237be139271ee9c5c580b218e015cd64bb3713ffbcf4

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

ActiveAdmin.register Ti::Category, as: 'Category' do

  menu :label => 'Категории',
       :parent => 'x_ti',
       :priority => 2

  permit_params :title,
                :full,
                :ord,
                :parent_category_id

  config.sort_order = 'id_asc'
  # config.clear_action_items!
  config.batch_actions = false

  # filter :title
  # filter :strsubcats
  # filter :is_excluded_from_filtering
  # filter :is_normal_price

  before_filter :skip_sidebar!, :only => :index

  # controller do
  #   cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
  # end

  index do
    # selectable_column
    id_column

    column :title
    column :ord
    column :parent_category do |pn|
      if pn.parent_category_id.present?
        rpn = Ti::Category.find_by(id:pn.parent_category_id)
        rpn.title unless rpn.nil?
      end
    end

    actions
  end

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

    f.inputs 'Свойства' do
      f.input :title
      f.input :ord

      f.input :parent_category,
              as: :select,
              collection: Ti::Category.all,
              input_html: {
                  :class => 'selectpicker',
                  :title => '',
                  :data => {
                      :size => 10,
                      :width => '400px'
                  },
                  :multiple => false
              },
              :include_blank => true

    end

    f.actions

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
c80_yax-0.1.0.12 engines/ti/app/admin/ti/categories.rb
c80_yax-0.1.0.11 engines/ti/app/admin/ti/categories.rb
c80_yax-0.1.0.10 engines/ti/app/admin/ti/categories.rb
c80_yax-0.1.0.9 engines/ti/app/admin/ti/categories.rb