Sha256: ef105a3f687e580fcbc130b42b826d5ce560ce0e49a017ffb9ac7ba1834fa571

Contents?: true

Size: 1014 Bytes

Versions: 6

Compression:

Stored size: 1014 Bytes

Contents

ActiveAdmin.register Category do
  menu :priority => 4, label: 'Categories'

  config.sort_order = 'lft_asc'
  sortable_tree_member_actions

  permit_params :id, :name, :parent_id, :description,
    image_attributes: [:id, :_destroy, :image]

  index do
    sortable_tree_indented_column :name

    actions
    sortable_tree_columns
  end

  filter :name

  form(:html => { :multipart => true }) do |f|
    f.inputs do
      f.input :parent, :as => :select
      f.input :name
      f.input :description, :as => :ckeditor
    end

    f.inputs 'Image', :for => [:image, f.object.image || f.object.build_image] do |image_form|
      image_form.input :image,
        :hint => f.object.image.present? ? image_tag(f.object.image.image.admin_thumb.url) : ''

      unless f.object.image.new_record?
        image_form.input :_destroy, :as => :boolean, :label => 'delete?'
      end
    end

    f.actions
  end

  controller do
    def find_resource
      scoped_collection.friendly.find(params[:id])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
power_shop-0.2.4 lib/generators/power_shop/install/templates/active_admin/category.rb.erb
power_shop-0.2.3 lib/generators/power_shop/install/templates/active_admin/category.rb.erb
power_shop-0.2.2 lib/generators/power_shop/install/templates/active_admin/category.rb.erb
power_shop-0.2.1 lib/generators/power_shop/install/templates/active_admin/category.rb.erb
power_shop-0.2.0 lib/generators/power_shop/install/templates/active_admin/category.rb.erb
power_shop-0.1.1 lib/generators/power_shop/install/templates/active_admin/category.rb.erb