Sha256: 25bfdfab9f47f907719b404950ac261a46e29c81e1fb00b443b67bd9497e3fca

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

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

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

  permit_params :title,
                :slug,
                :parent_category_id

  config.per_page = 100
  batch_action :destroy, false
  config.sort_order = 'ord_asc'
  before_filter :skip_sidebar!, :only => :index

  index do
    selectable_column
    column :title
    column :parent_category
    column :child_categories do |cat|
      res = ""
      if cat.child_categories.count > 0
        cat.child_categories.map do |subcat|
          res += "#{subcat.title}<br>"
        end
      end
      res.html_safe
    end
    actions
  end

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

    f.inputs 'Свойства' do
      f.input :title
      f.input :parent_category,
              :as => :select,
              :input_html => {
                  :class => 'selectpicker',
                  'data-size' => "10",
                  'data-width' => '400px',
                  :multiple => false
              }
    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/categories.rb
c80_catoffers-0.1.0.7 app/admin/c80_catoffers/categories.rb
c80_catoffers-0.1.0.6 app/admin/c80_catoffers/categories.rb
c80_catoffers-0.1.0.5 app/admin/c80_catoffers/categories.rb
c80_catoffers-0.1.0.4 app/admin/c80_catoffers/categories.rb
c80_catoffers-0.1.0.3 app/admin/c80_catoffers/categories.rb
c80_catoffers-0.1.0.2 app/admin/c80_catoffers/categories.rb
c80_catoffers-0.1.0.1 app/admin/c80_catoffers/categories.rb