-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Transfer Processing Queue with tests
** Why are these changes being introduced: * The first step of the Transfer processing workflow is to allow staff to identify which Transfer they want to process (out of all available) and get to the page that will allow them to process the submitted files. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/ETD-276 ** How does this address that need: * This defines a transfer selection screen (/transfer/select) where staff can see the list of available transfer records. This display can be filtered by graduation month (or by arbitrary user input). When the user clicks on any transfer in the list, they are taken to the (blank) detail page for that transfer. Future work will further develop that interface. * This PR also includes relevant tests for the navigation, the new path, and the existing ability model. ** Document any side effects to this change: * Part of the UI for this transfer selection screen is enabled by a jQuery plugin, DataTables. This plugin, while very useful out of the box, does increase our reliance on the jQuery ecosystem. A future discussion in EngX may lead to us needing to re-develop this screen using either Vue or native Javascript.
- Loading branch information
1 parent
7d9130e
commit 54d382e
Showing
12 changed files
with
162 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ def processor | |
can :stats, Thesis | ||
|
||
can :read, Transfer | ||
can :select, Transfer | ||
can :read, Hold | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<tr class="empty"> | ||
<td colspan="6">There were no transfers matching your parameters.</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<tr> | ||
<td data-sort="<%= transfer.created_at %>"><%= link_to transfer.created_at.in_time_zone('Eastern Time (US & Canada)').strftime('%b %-d, %Y<br>%l:%M %p').html_safe, url_for(transfer) %></td> | ||
<td data-sort="<%= transfer.grad_date %>"><%= transfer.graduation_month[...3] %> <%= transfer.graduation_year %></td> | ||
<td><%= transfer.department.name_dw %></td> | ||
<td><%= transfer.user.display_name %></td> | ||
<td><%= transfer.files.count %></td> | ||
<td><%= transfer.note.present? ? "<span title='#{transfer.note}'>#{transfer.note[..10]}...</span>".html_safe : "" %></td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<%= content_for(:title, "Transfer Processing | MIT Libraries") %> | ||
|
||
<% content_for :additional_js do %> | ||
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script> | ||
<% end %> | ||
|
||
<link href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet"> | ||
|
||
<h3 class="title title-page">Transfer Processing Queue</h3> | ||
|
||
<div id="term-list" class="filter-row"> | ||
<button data-filter="*">Show<br>all</button> | ||
</div> | ||
|
||
<table class="table" id="transferQueue"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Transfer date</th> | ||
<th scope="col">Degree date</th> | ||
<th scope="col">Department</th> | ||
<th scope="col">Dept. Admin</th> | ||
<th scope="col">Files</th> | ||
<th scope="col">Notes</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render(partial: 'transfer/transfer', collection: @transfers) || render('empty') %> | ||
</tbody> | ||
</table> | ||
|
||
<script type="text/javascript"> | ||
$(document).ready( function () { | ||
if( document.getElementById('transferQueue').getElementsByClassName('empty').length === 0 ) { | ||
var table = $('#transferQueue').DataTable({ | ||
"order": [[ 1, "asc" ]] | ||
}); | ||
|
||
// Populate filter buttons with found values | ||
var terms = [...new Set( table.columns(1).data()[0] )]; | ||
terms.forEach(element => { | ||
document | ||
.getElementById("term-list") | ||
.insertAdjacentHTML("beforeend", ` | ||
<button data-filter="${element}">${element.replace(' ', '<br>')}</button> | ||
`); | ||
}); | ||
|
||
// Perform filtering when buttons are clicked | ||
$(".filter-row button").click(function() { | ||
var needle = $(this).data("filter"); | ||
$.fn.dataTable.ext.search.push( | ||
function( settings, data, dataIndex ) { | ||
return ( data[1] === needle || needle === "*" ) | ||
? true | ||
: false | ||
} | ||
); | ||
table.draw(); | ||
$.fn.dataTable.ext.search.pop(); | ||
}); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
<%= content_for(:title, "Thesis Transfer Submission | MIT Libraries") %> | ||
<%= content_for(:title, "Transfer Processing | MIT Libraries") %> | ||
|
||
<h3 class="title title-page">Transfer file list</h3> | ||
|
||
<p><%= link_to "Back to Transfer queue", transfer_select_path %></p> | ||
|
||
<p>This will be the display of all files in this Transfer, for processing into Thesis records.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters