Sha256: 809ad80e23a175615e59fbbcfc4b86e8b7b4d97a500d6f737e1654e127497944

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

ActiveAdmin.register C80NewsTz::Location, :as => 'Location' do

  menu :label => "Места на главной", :parent => 'Содержимое сайта'

  before_filter :skip_sidebar!, :only => :index

  permit_params :fact_ids => []

  config.sort_order = 'id_asc'

  index do
    id_column
    column :title

    column :facts do |loc|
      # нарисуем список
      list_items = ((loc.facts.map { |p|
        "<li>• #{ p.title } <a href='/news/#{p.slug}' target='_blank'>[view]</a> <a href='/admin/facts/#{p.slug}/edit'>[edit]</a> </li>"
      }).join("")).html_safe

      "<ul>#{list_items}</ul>".html_safe
    end

    actions
  end

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

      f.input :facts,
              :as => :select,
              :input_html => {:multiple => false},
              :include_blank => true,
              :member_label => Proc.new { |p|
                p.title
              }

    end
    f.actions
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
c80_news_tz-0.1.1.18 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.17 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.16 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.15 app/admin/c80_news_tz/locations.rb