delonnewman/dragnet

View on GitHub
app/views/workspace/surveys.html.erb

Summary

Maintainability
Test Coverage
<%= render 'workspace/tabs', selected: :surveys, survey_count: listing.pager.count %>

<div class="mt-4">
  <% listing.surveys.each do |survey| %>
    <div class="survey border-bottom mt-3 mb-4 pb-3">
      <div class="d-flex justify-content-between">
        <div>
          <div class="h6">
            <%= link_to survey.name, survey_path(survey) %>
            <%= survey_copy_of_link(survey) %>
          </div>
          <div>
            <span class="badge bg-secondary">
              <%= survey_public_indicator(survey) %>
            </span>
            <span class="badge bg-info">
              <%= number_with_delimiter survey.replies.count %>&nbsp;<%= survey.replies.count == 1 ? 'record' : 'records' %>
            </span>
          </div>
          <div>
            <div class="mt-2">
              <div class="mt-1">
                <%= survey_data_link(survey) %>&nbsp;
                <%= survey_summary_link(survey) %>
              </div>
            </div>
            <div class="d-flex align-items-center mt-2">
              <%= survey_status_indicator(survey, include_label: true) %>
              <small class="text-muted ms-3">Updated <%= time_ago_in_words survey.updated_at %> ago</small>
            </div>
          </div>
        </div>
        <div>
          <div class="d-flex justify-content-end align-items-center">
            <%= edit_survey_link(survey, include_label: true) %>
            <%= survey_share_dropdown(survey) %>
          </div>
          <div class="mt-2 d-flex justify-content-end align-items-center">
            <%= sparklines listing.reply_counts_for(survey) %>
          </div>
        </div>
      </div>
    </div>
  <% end %>
</div>

<% if listing.show_pagination? %>
  <div class="d-flex justify-content-center align-items-center">
    <%== pagy_bootstrap_nav(listing.pager) %>
  </div>
<% end %>