denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyBlog/app/views/shiny_blog/admin/blog_posts/index.html.erb

Summary

Maintainability
Test Coverage
<%= render partial: 'admin/includes/search', locals: { action: shiny_blog.search_blog_posts_path, placeholder: t( '.search' ) } %>

<table class="table table-responsive-sm table-striped">
  <thead>
    <tr>
      <th class="longer">
        Title
      </th>
      <th>
        Author
      </th>
      <th>
        Posted
      </th>
      <th>
      </th>
    </tr>
  </thead>

  <tbody>
    <% @posts.each do |post| %>
    <tr>
      <td>
        <%= post.title %>
      </td>
      <td>
        <%= post.author.name %>
      </td>
      <td>
        <%= display_time_on_date( post.posted_at ) %>
      </td>
      <td class="actions">
        <%= link_to t( 'view'   ), post.path %>
        <%= link_to t( 'edit'   ), shiny_blog.edit_blog_post_path( post ) %>
        <%= link_to t( 'delete' ), shiny_blog.blog_post_path( post ),
            method: :delete, data: { confirm: t( 'are_you_sure' ) } %>
      </td>
    </tr>
    <% end %>
  </tbody>
</table>

<%= render partial: 'admin/includes/pager', locals: { pagy: @pagy, name: @posts.name } %>