Sha256: c74778218abff14841255ba3a3acf5767428d17a0cd44f8b5c2e4aad34b274da

Contents?: true

Size: 1.56 KB

Versions: 12

Compression:

Stored size: 1.56 KB

Contents

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

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

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

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

  scope  "All", :all
  scope  "Listed", :listed

  # 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 :is_listed
    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 :is_listed

      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

12 entries across 12 versions & 1 rubygems

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