BluePanel/rails-website

View on GitHub
app/views/articles/_article.html.erb

Summary

Maintainability
Test Coverage
<article>
  <header>
    <h1><%= link_to article.title, article_path(article) %></h1>
    <div class="articleInfo" >
      <span class="articleAuthor" ><%= article.author.name %></span>
      <span class="articleDate" ><%=l article.created_at %></span>
    </div>
  </header>
  <div class="articleBody">
    <%= (defined?(locals) && locals[:preview]) ? raw(article.content_preview) : raw(article.content_with_bbcode_and_formatting) %>
  </div>
  <footer class="articleBottomMargin">
    <p class="editedArticle">
      <%= editedHelper(article) %>
    </p>
    <% if can? (:edit || :destroy), article %>
      <div class="articleButtons">
        <% if can? :edit, article %>
          <%= link_to t('.edit', :default => t("helpers.links.edit")),
                      edit_article_path(article), :class => 'btn btn-default btn-xs' %>
        <% end %>
        <% if can? :destroy, article %>
          <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
                      article_path(article),
                      :method => :delete,
                      :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
                      :class => 'btn btn-xs btn-danger' %>
        <% end %>
      </div>
    <% end %>
  </footer>
</article>