- include_stylesheet('admin/forum')
= render_region :top 

#forums_table.outset
  %table#forums.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
    %thead
      %tr
        - render_region :thead do |thead|
          - thead.title_header do
            %th.forum 
              =t('forum_extension.forum').titlecase
          - thead.description_header do
            %th.description
              =t('forum_extension.description').titlecase
          - thead.latest_header do
            %th.forum_latest 
              =t('forum_extension.latest_activity').titlecase
          - thead.modify_header do
            %th.action
    %tbody
      - @forums.each do |forum|
        %tr
          - render_region :tbody do |tbody|
            - tbody.title_cell do
              %td.name
                = link_to forum.name, edit_admin_forum_url(:id => forum)
                    
            - tbody.description_cell do
              %td.forum_description
                = textilize(forum.description)

            - tbody.latest_cell do
              %td.forum_latest
                %ul.latest
                  - forum.topics.latest(1).each do |topic|
                    %li.topic
                      = friendly_date(topic.replied_at) + ":"
                      - if topic.replied_by
                        = t('forum_extension.new_reply_to')
                        = link_to_topic(topic, :class => 'topic')
                        = t('forum_extension.from_reader', :name => topic.replied_by.name)
                      - else 
                        = t('forum_extension.new_topic')
                        = link_to_topic(topic, :class => 'topic')
                        = t('forum_extension.from_reader', :name => topic.reader.name)

            - tbody.modify_cell do
              %td.actions
                - if admin?
                  = link_to image('minus') + ' ' + t('remove'), remove_admin_forum_url(:id => forum) , :class => 'action'
                - else
                  %span.action.disabled
                    = image('minus_disabled')
                    = " " + t('remove')

- render_region :bottom do |bottom|
  - bottom.buttons do
    #actions
      = pagination_for @forums
      %ul
        %li= link_to image('plus') + " " + t("forum_extension.new_forum"), new_admin_forum_url