<%= table_for @contents do |t| columns = [:content] columns.push :categories if @section.categories.any? columns.push :comments if defined?(Comment) columns += [:published, :actions] t.column *columns t.row do |r, content| r.add_class "level_#{content.level}" r.cell content_status(content) + " " + link_to(content.title, [:edit, :admin, @section, content], :class => content.state) r.cell content.category_titles.join(", ") if @section.categories.any? r.cell content.accept_comments? && content.comments.present? ? link_to(content.comments.size, admin_comments_path) : "none" if defined?(Comment) r.cell published_at_formatted(content) r.cell link_to("Edit", [:edit, :admin, @section, content], :class => "edit content") + link_to("Delete", [:admin, @section, content], :method => :delete, :class => "delete content") end t.empty :p, :class => 'empty' do raw "There are no contents in #{@section.title}. " + link_to("Create one now", [:new, :admin, @section, :article]) end end %>