Sha256: a8e1f456f91f412ff1171998764e914360bea2cb6f6cdd4d470527a51a29ef27

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# ПОДкатегории строительных материалов
ActiveAdmin.register C80Yax::Cat, as: 'Cat' do

  menu :label => proc{ I18n.t('c80_yax.active_admin.menu.cat')},
       :parent => 'x_c80_yax',
       :priority => 1

  permit_params :title,
                :slug,
                :ord,
                :image,
                :strsubcat_ids => []

  config.batch_actions = false
  config.sort_order = 'id_asc'
  before_filter :skip_sidebar!, :only => :index

  index do
    id_column
    column :ord
    column :title
    column :image do |cat|
      cat_image(cat)
    end
    column :strsubcats do |cat|
      res = '-'
      if cat.strsubcats.count > 0
        res = ''
        cat.strsubcats.map do |strsubcat|
          res += "• #{strsubcat.title}<br>"
        end
      end
      res.html_safe
    end

    actions
  end

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

    f.inputs 'Свойства категории' do
      f.input :title
      f.input :ord
      f.input :image, :as => :file, :hint => cat_image(f.object)
      f.input :strsubcats, :as => :check_boxes
    end

    f.actions
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
c80_yax-0.1.0.4 app/admin/c80_yax/cats.rb