tnantoka/blog

View on GitHub
app/views/attachments/index.html.slim

Summary

Maintainability
Test Coverage
table.table.table-bordered.table-condensed
  tr
    th= t('.id')
    th= t('.file_name')
    th= t('.posts')
    th= t('.action')
  - @attachments.each do |attachment|
    tr
      td= attachment.id
      td
        = link_to attachment.file.url do
          - if attachment.image?
            = image_tag attachment.file.url, class: 'image-preview'
            br
          = link_to attachment.file_file_name, attachment.file.url
      td
        ul.list-unstyled
          - attachment.posts.each do |post|
            li= link_to post.title, post
      td= link_to t('.delete'), attachment, method: :delete, data: { confirm: t('shared.are_you_sure') } 

= paginate @attachments
= render 'form'