Sha256: a8aa6fedc417e603178eb6729a59b6991bfd8ffa1043f7b0321ebafe56e1fb99

Contents?: true

Size: 1.58 KB

Versions: 13

Compression:

Stored size: 1.58 KB

Contents

ActiveAdmin.register Ti::Doc, :as => 'Docs' do

  before_filter :skip_sidebar!, :only => :index

  menu :label => 'Документы',
       :parent => 'x_ti',
       :priority => 1

  permit_params :title,
                :full,
                :category_ids => [],
                :dphotos_attributes => [:id,:image,:_destroy]

  index do
    selectable_column
    id_column
    column :title
    column :created_at do |fact|
      local_time(fact[:created_at], format: '%e.%m.%Y')
    end

    column '' do |fact|
      if fact.dphotos.count > 0
        image_tag(fact.dphotos.first.image.thumb_sm)
      end
    end

    column :full do |doc|
      res = '-'
      if doc.full.present?
        res = "#{doc.full[0..30]}..."
      end
      res
    end

    actions
  end

  form(:html => {:multipart => true}) do |f|
    f.inputs 'Свойства' do
      f.input :title

      f.input :categories,
              :as => :select,
              :input_html => {
                  :title => '',
                  :class => 'selectpicker',
                  :data => {
                      :size => 10
                  },
                  :multiple => false
              },
              :include_blank => true

      f.inputs 'Фото' do
        f.has_many :dphotos, :allow_destroy => true do |dphoto|
          dphoto.input :image,
                       :as => :file,
                       :hint => image_tag(dphoto.object.image.thumb_sm)
        end
      end

      f.input :full, :as => :ckeditor,
              :input_html => {:style => 'height:500px', rows: 20}

    end
    f.actions
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
c80_yax-0.1.0.22 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.21 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.20 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.18 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.17 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.16 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.15 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.14 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.13 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.12 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.11 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.10 engines/ti/app/admin/ti/docs.rb
c80_yax-0.1.0.9 engines/ti/app/admin/ti/docs.rb