Noosfero/noosfero

View on GitHub
plugins/recent_content/views/blocks/recent_content.html.erb

Summary

Maintainability
Test Coverage
<% unless block.root.nil? %>
  <div id="recent-content-block">
    <% children = block.articles_of_folder(block.root, block.total_items)%>
    <div class="recent-content">
      <%= block_title(block.title.blank? ? c_("Recent content") : block.title, block.subtitle ) %>
      <% if block.show_blog_picture and !block.root.image.nil? %>
        <div class="recent-content-cover">
          <%= image_tag(block.root.image.public_filename()) %>
        </div>
      <% end %>
    </div>
    <% if block.mode?('title_only') %>
      <div class="recent-content-title">
        <ul>
          <% children.each do |item| %>
            <li> <%= link_to(h(item.title), item.url)%></li>
          <% end %>
        </ul>
      </div>
    <% elsif block.mode?('title_and_abstract') %>
      <div class="recent-content-abstract">
        <% children.each do |item| %>
          <h2><%= link_to(item.title,item.url, :class => 'post-title')%></h2>
          <span class="post-date"><%= show_date(item.published_at, true)%></span>
          <div class="headline"><%=item.lead%></div>
          <p class="highlighted-news-read-more"><%= link_to(_('Read more'), item.url) %></p>
        <% end %>
      </div>
    <% else %>
      <div class="recent-content-full">
       <% children.each do |item| %>
          <h2><%= link_to(item.title,item.url, :class => 'post-title')%></h2>
          <span class="post-date"><%= show_date(item.published_at, true)%></span>
          <div class="headline"><%=item.body%></div>
          <p class="highlighted-news-read-more"><%= link_to(_('Read more'), item.url) %></p>
      <% end %>
      </div>
    <% end %>
    <% if profile %>
      <%= link_to _('View All'), {:profile => profile.identifier, :controller => 'content_viewer', :action => 'view_page', :page => block.root.path}, {:class => 'see-all'} %>
    <% end %>
  </div>
<% else %>
  <span class="alert-block">
    <%= _('This is the recent content block. Please edit it to show the content you want.') %>
  </span>
<% end %>