Sha256: 802f0af8d4b16eae3ddec689f703defae32e00f06ad914d15c698889d0408fc2

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

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

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

  before_filter :skip_sidebar!, :only => :index

  permit_params :rubric_ids => []

  config.sort_order = 'id_asc'

  index do
    id_column
    # column :title

    column :rubrics do |loc|
      # нарисуем список
      list_items = ((loc.rubrics.map { |p|
        "<li>• #{ p.title } <a href='/rubrics/#{p.slug}' target='_blank'>[view]</a> <a href='/admin/rubrics/#{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 :id, :input_html => {:readonly => true }

      f.input :rubrics,
              :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/spots.rb
c80_news_tz-0.1.1.25 app/admin/c80_news_tz/spots.rb
c80_news_tz-0.1.1.24 app/admin/c80_news_tz/spots.rb
c80_news_tz-0.1.1.23 app/admin/c80_news_tz/spots.rb
c80_news_tz-0.1.1.22 app/admin/c80_news_tz/spots.rb
c80_news_tz-0.1.1.21 app/admin/c80_news_tz/spots.rb
c80_news_tz-0.1.1.19 app/admin/c80_news_tz/spots.rb