Skip to content
This repository was archived by the owner on Jun 30, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Report < ApplicationRecord

# Provides a short human-readable description for this record, for GUI prompts
alias_attribute :description, :name
default_scope { includes(%i[user]) }

enum status: {
pending: 0,
Expand Down
15 changes: 9 additions & 6 deletions app/views/reports/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
<table class="table table-striped">
<thead>
<tr>
<th id="name">Name</th>
<th id="format">Format</th>
<th id="creator_name">Creator</th>
<th id="created_at">Created At</th>
<th id="status">Status</th>
<th id="name"><%= multi_sort_link( 'reports.name', 'Name', :desc) %></th>
<th id="format"><%= multi_sort_link( :format, 'Format', :desc) %></th>
<th id="creator_name"><%= multi_sort_link( 'users.name', 'Creator', :desc) %></th>
<th id="created_at"><%= multi_sort_link( 'reports.created_at', 'Created At', :desc) %></th>
<th id="status"><%= multi_sort_link( :status, 'Status', :desc) %></th>
<th id="download">Output</th>
<th id="actions">
<%= link_to(t('reset_sorting'), { controller: 'reports' }, class: 'btn btn-link') if sorted? %>
</th>
</tr>
</thead>

Expand All @@ -40,4 +43,4 @@
<div class="btn-toolbar pagination">
<div class='btn-group'><%= will_paginate( @requests, renderer: BootstrapPagination::Rails) %></div>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion app/views/shared/_requests_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<% end %>
<th id="actions">
<%= reset_sorts_link %>
</tr>
</th>
</tr>
</thead>
<tbody>
<%- @requests.each do |record| %>
Expand Down
19 changes: 19 additions & 0 deletions test/system/report_index_view_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require 'application_system_test_case'

class ReportIndexViewTest < ApplicationSystemTestCase
def setup
login_admin
end

test 'should keep page and sort when deleting' do
click_link 'admin'
click_link 'Reports'
click_link 'Name'
click_link 'Format'
click_link 'Creator'
click_link 'Created At'
assert :success
end
end