initforthe/spina-blog

View on GitHub
app/views/spina/admin/blog/posts/_post.html.erb

Summary

Maintainability
Test Coverage
<div class="border-b border-gray-200 flex items-center justify-between space-x-8 pr-2">

  <%= link_to spina.edit_admin_blog_post_path(post.id), class: 'flex items-center text-spina text-sm p-4 hover:text-spina-dark font-medium' do %>
    <% if post.featured? %>
      <%= heroicon('star', style: :solid, class: 'w-6 h-6 text-yellow-500 mr-3') %>
    <% end %>
    <div>
      <%= post.title %>
      <div class="text-gray-400 text-xs">
        <%= t('spina.blog.posts.created_at_in_words', date: time_ago_in_words(post.created_at)) %>
      </div>
    </div>
  <% end %>

  <div class="flex-1"></div>

  <div>
    <% if post.draft? %>
      <span class="text-sm text-gray-400"><%=t 'spina.blog.posts.concept' %></span>
    <% elsif post.published_at and post.published_at > Time.now %>
      <span class="text-sm text-gray-400">
        <%= t('spina.blog.posts.scheduled_publication_date', date: post.decorate.published_date) %>
      </span>
    <% end %>
  </div>

  <div>
    <%= link_to spina.edit_admin_blog_post_path(post.id), class: "btn btn-default px-3" do %>
      <%= heroicon('pencil', style: :solid, class: 'w-4 h-4') %>
    <% end %>
  </div>
</div>