tryzealot/zealot

View on GitHub
app/views/channels/filters/_list.html.slim

Summary

Maintainability
Test Coverage
- if releases.present?
  = form_with model: channel, url: destroy_releases_channel_path(channel), method: :delete, \
    data: { controller: 'bulk-operation' } do |f|
    .card-body.p-0
      table.table.table-hover
        tr
          - if current_user&.manage?(app: channel.app)
            th style="width: 10px"
              input type="checkbox" data-bulk-operation-target="checkboxAll"
          th = t('channels.show.release_version')
          th = t('channels.show.build_version')
          - if channel.device_type.downcase == 'ios'
            th = t('channels.show.release_type')
          th = t('channels.show.git_branch')
          th.d-none.d-sm-table-cell = t('channels.show.git_commit')
          th = t('channels.show.uploaded_at')

          - releases.each_with_index do |release, index|
            tr
              - if current_user&.manage?(app: channel.app)
                td
                  input [type="checkbox" name="channel[release_ids][]" value="#{release.id}"
                        data-bulk-operation-target="checkbox" data-action="bulk-operation#switchDeleteButton"]
              td
                - if release.release_version == (params[:id] || params[:name])
                  = release.release_version || '-'
                - else
                  = link_to (release.release_version || '-'), friendly_channel_version_path(release.channel, release.release_version)
              td
                = release.build_version || '-'
              - if channel.device_type.downcase == 'ios'
                td
                  = release_type_url_builder(release)
              td
                = git_branch_url(release) || '-'
              td.d-none.d-sm-table-cell
                = git_commit_url(release.channel.git_url, release.git_commit) || '-'
              td
                span data-toggle="tooltip" title="#{release.created_at}"
                  = time_ago_in_words(release.created_at)

    .card-footer
      - if @releases.total_pages > 1
        .float-right
          = paginate @releases

      - if current_user&.manage?(app: channel.app)
        .actions
          .buttons
            = f.submit t('.delete'), class: 'btn btn-danger', \
              data: { bulk_operation_target: 'destroyButton', turbo_confirm: t('channels.messages.confirm.destroy') }
- else
  .card-body.p-0
    p.p-3 = t('channels.show.empty_version')