Sha256: b1c3e45483043185e4e3a87f063c11364340082341ea1fdfabbb9b42c1169bf8

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

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

  menu :label => "Рубрики", :parent => 'Содержимое сайта'

  before_filter :skip_sidebar!, :only => :index

  permit_params :title, :fact_ids => []

  config.sort_order = 'title_asc'

  # controller do
  #   cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
  # end

  index do
    id_column
    column :title

    column :facts do |rubric|
      # нарисуем список
      list_items = ((rubric.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 => :check_boxes,
              :member_label => Proc.new { |p|
                p.title
              }

    end
    f.actions
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
c80_news_tz-0.1.1.26 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.25 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.24 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.23 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.22 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.21 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.19 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.18 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.17 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.16 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.15 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.1 app/admin/c80_news_tz/rubrics.rb
c80_news_tz-0.1.1.0 app/admin/c80_news_tz/rubrics.rb