Sha256: 3a3e783e26d146e070c176e90cf96015cfe111811d08c8ec4a335be52922abe5

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

ActiveAdmin.register C80Estate::Area, as: 'Area' do

  # scope_to :current_admin_user, association_method: :sites_list

  menu :label => "Площади"

  permit_params :title,
                :desc,
                :owner_id,
                :owner_type,
                :atype_id,
                :property_id,
                :aphotos_attributes => [:id,:image,:_destroy],
                :item_props_attributes => [:value, :_destroy, :prop_name_id, :id]

  config.sort_order = 'id_asc'

  index do
    column :title
    column :atype do |area|
      area.atype.title
    end
    actions
  end

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

    f.inputs 'Свойства' do
      f.input :title
      f.input :atype, :input_html => { :class => 'selectpicker', 'data-size' => "5", 'data-width' => '300px'}
      f.input :property, :input_html => { :class => 'selectpicker', 'data-size' => "5", 'data-width' => '300px'}
      f.input :desc, :as => :ckeditor

      f.inputs "Характеристики" do

        f.has_many :item_props, :allow_destroy => true do |item_prop|
          item_prop.input :prop_name
          item_prop.input :value
        end

      end

      f.has_many :aphotos, :allow_destroy => true do |gp|
        gp.input :image,
                 :as => :file,
                 :hint => image_tag(gp.object.image.thumb512)
      end

      f.input :owner_id, :input_html => { :value => current_admin_user.id }, as: :hidden
      f.input :owner_type, :input_html => { :value => "AdminUser" }, as: :hidden
    end

    f.actions
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
c80_estate-0.1.0 app/admin/c80_estate/areas.rb