= javascript_include_tag 'news'

- cache do

  .cmd
    = action_icon 'add', 'Adicionar', new_course_news_url

  %h4.title= h(@course.full_name)
  %h1.title Notícias

  = auto_discovery_link_tag :rss, formatted_course_news_index_url(@course, :rss)

  .box.div_news
    - if !@course.news.empty?
      %table
        - @course.news.each do |n|
          %tr[n]
            %td.top.aright
              = n.timestamp.strftime("%d&nbsp;de&nbsp;%B")
            %td
              .title= link_to h(n.title), course_news_url(@course, n)
              .description{:style => (n.id == params[:id].to_i ? '' : 'display: none')}
                .cmd
                  = action_icon 'edit', 'Editar', edit_course_news_url(@course, n)
                  = action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
                = h(n.body)
                = "Sem descrição" if n.body.empty?
    - else
      .box
        %ul
          %li.no_itens Nenhuma notícia
