Sha256: 640568f25a6a32b98c410bd31b5b270d2a6d274fc2bec5cf5221eacccca3cddb

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 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

7 entries across 7 versions & 1 rubygems

Version Path
c80_news_tz-0.1.1.26 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.25 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.24 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.23 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.22 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.21 app/admin/c80_news_tz/locations.rb
c80_news_tz-0.1.1.19 app/admin/c80_news_tz/locations.rb