app/views/itineraries/_table.html.slim

Summary

Maintainability
Test Coverage
.table-responsive
  table.table.table-itinerary
    thead
      tr
        th = Itinerary.human_attribute_name(:start_address)
        th = Itinerary.human_attribute_name(:end_address)
        th
          span.d-block.d-sm-none
            span data-bs-toggle='tooltip' title=t('itineraries.common.features')
              span.fas.fa-info-circle
              span.visually-hidden = t('itineraries.common.features')
          span.d-none.d-sm-block = t('itineraries.common.features')
        - if edit
          th = t('helpers.actions')
        - else
          th = User.model_name.human
          th = Itinerary.human_attribute_name(:leave_date)
    tbody
      - itineraries.each do |itinerary|
        tr.align-middle
          td = link_to itinerary.start_address, itinerary_path(itinerary)
          td = link_to itinerary.end_address, itinerary_path(itinerary)
          td
            .feature-icons
              - if itinerary.pink?
                span data-bs-toggle='tooltip' title=Itinerary.human_attribute_name(:pink)
                  span.fas.fa-lock.feature-icon.fa-fw.text-pink
                  span.visually-hidden = Itinerary.human_attribute_name(:pink)
              - if itinerary.daily?
                span data-bs-toggle='tooltip' title=Itinerary.human_attribute_name(:daily)
                  span.fas.fa-redo.feature-icon.fa-fw
                  span.visually-hidden = Itinerary.human_attribute_name(:daily)
              - if itinerary.round_trip?
                span data-bs-toggle='tooltip' title=Itinerary.human_attribute_name(:round_trip)
                  span.fas.fa-exchange-alt.feature-icon.fa-fw
                  span.visually-hidden = Itinerary.human_attribute_name(:round_trip)
              - if itinerary.pets_allowed?
                span data-bs-toggle='tooltip' title=Itinerary.human_attribute_name(:pets_allowed)
                  span.fas.fa-paw.feature-icon.fa-fw
                  span.visually-hidden = Itinerary.human_attribute_name(:pets_allowed)
              - if itinerary.smoking_allowed?
                span data-bs-toggle='tooltip' title=Itinerary.human_attribute_name(:smoking_allowed)
                  span.fas.fa-smoking.feature-icon.fa-fw
                  span.visually-hidden = Itinerary.human_attribute_name(:smoking_allowed)
          - if edit
            td
              = link_to edit_itinerary_path(itinerary), class: 'btn btn-sm btn-secondary me-2' do
                span.fas.fa-pencil-alt<>
                = t('helpers.links.edit')
              = link_to itinerary_path(itinerary), method: :delete, data: { confirm: t('helpers.links.confirm') }, class: 'btn btn-sm btn-danger' do
                span.fas.fa-times<>
                = t('helpers.links.destroy')
          - else
            td = link_to itinerary.user, user_path(itinerary.user)
            td = l(itinerary.leave_date.in_time_zone, format: :short)