Skip to content
Open
Show file tree
Hide file tree
Changes from 9 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
27 changes: 17 additions & 10 deletions app/static/js/allPendingForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,21 +353,28 @@ function clearTextArea() { //makes sure that it empties text areas and p tags wh



function loadOverloadModal(formHistoryID, laborStatusFormID) {
/*
This method sends an AJAX call to recieve data used to populate
the overload modal.
function loadOverloadModal(formHistoryID) {
/*
This method resets the modal content to a loading state to prevent
displaying stale data, then fetches and renders the new form data.
*/

$("#overloadModal").find(".modal-content").html('<div class="modal-body">Loading...</div>');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious about the use of the "Loading..." text here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The need for the "Loading..." is because the modal content persists from the last time it was opened. This creates a "flash" of the wrong student's data, followed by a self-correction when it is updated.

Through the way that it is handeld we are creating a buffer that is user-friendly (as it gives visual feedback), at the same time, renders the right information.

$("#overloadModal").modal("show");
$("#overloadModal").find('.modal-content').load('/admin/overloadModal/' + formHistoryID);
$("#overloadModal").find('.modal-content').load('/admin/overloadModal/' + formHistoryID) ;

}


function loadReleaseModal(formHistoryID, laborStatusFormID) {
$("#modalRelease").modal("show");
function loadReleaseModal(formHistoryID) {
/*
This method resets the modal content to a loading state to prevent
displaying stale data, then fetches and renders the new form data.
*/
$("#modalRelease").find('.modal-content').html('<div class="modal-body">Loading...</div>');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we setting the HTML to Loading if we're going to set it to the actual content in the next line? Also I love this fix!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one, I have fixed it now. Currently, it will no longer be in that order; it will set it to loading and then render it, giving it time to display the content from the ajax request.

$("#modalRelease").modal("show");
$("#modalRelease").find('.modal-content').load('/admin/releaseModal/' + formHistoryID);



}


Expand Down Expand Up @@ -604,7 +611,7 @@ function notesCounter(laborStatusFormID, formHistoryID){
success: function(response) {
var viewNotesID = '#notes_' + String(formHistoryID)
var modalViewNotesID = '#modalNote_' + String(formHistoryID)
$(viewNotesID).html('View Notes (' + response['noteTotal'] + ')')
$(viewNotesID).html('Notes (' + response['noteTotal'] + ')')
$(modalViewNotesID).html('View Notes (' + response['noteTotal'] + ')')
},
error: function(request,status,error){
Expand Down
30 changes: 20 additions & 10 deletions app/templates/admin/allPendingForms.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h1>{{title}}</h1>
{% endwith %}
<a role="menuitem" href="#"
<span id="{{pendingOverloadFormPairs[allForms.formHistoryID]}}"
onclick="loadOverloadModal({{pendingOverloadFormPairs[allForms.formHistoryID]}}, {{allForms.formID.laborStatusFormID}});"
onclick="loadOverloadModal({{pendingOverloadFormPairs[allForms.formHistoryID]}});"
aria-label="Pending Overload Form" title="Manage Overload Form" class="glyphicon glyphicon-exclamation-sign fa-lg"
style="color:red; top: 10px"></span></a>
</td>
Expand Down Expand Up @@ -206,7 +206,7 @@ <h1>{{title}}</h1>
<span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="menu1" style="min-width: 100%;">
{% if allForms.historyType.historyTypeName == 'Labor Overload Form' %}
<li role="presentation">
<li role="presentation" id ="{{allForms.formHistoryID}}" onclick="loadOverloadModal({{allForms.formHistoryID}});">
{% if currentUser.isFinancialAidAdmin or currentUser.isSaasAdmin %}
{% set formurl = "financialAidOverloadApproval" %}
{% if currentUser.isSaasAdmin %}
Expand All @@ -215,18 +215,28 @@ <h1>{{title}}</h1>
<a role="menuitem" href="/admin/{{formurl}}/{{allForms.formHistoryID}}">Manage</a>
{% else %}
<a role="menuitem" href="#" >
<span id="{{allForms.formHistoryID}}" onclick="loadOverloadModal({{allForms.formHistoryID}}, {{allForms.formID.laborStatusFormID}});">Manage</span>
<span id="{{allForms.formHistoryID}}" onclick="loadOverloadModal({{allForms.formHistoryID}});">Manage</span>
</a>
{% endif %}
</li>
{% elif allForms.historyType.historyTypeName == 'Labor Release Form' %}
<li role="presentation"><a role="menuitem" href="#">
<span id="{{allForms.formHistoryID}}"
onclick="loadReleaseModal({{allForms.formHistoryID}}, {{allForms.formID.laborStatusFormID}});">Manage</span></a></li>
<li role="presentation">
<a id="{{allForms.formHistoryID}}"
role="menuitem"
href="#"
class="btn btn-secondary"
onclick="event.preventDefault(); loadReleaseModal('{{allForms.formHistoryID}}');">
Manage
</a></li>
{% elif allForms.formHistoryID in pendingOverloadFormPairs %}
<li role="presentation"><a role="menuitem" href="#">
<span id="{{allForms.formHistoryID}}"
onclick="loadOverloadModal({{pendingOverloadFormPairs[allForms.formHistoryID]}}, {{allForms.formID.laborStatusFormID}});">Manage</span></a></li>
<li role="presentation">
<a id="{{allForms.formHistoryID}}"
role="menuitem"
href="#"
class="btn btn-secondary"
onclick="event.preventDefault(); loadOverloadModal('{{allForms.formHistoryID}}');">
Manage
</a></li>
{% else %}
<li role="presentation"><a role="menuitem" href="#">
<span onclick="insertDenial({{allForms.formHistoryID}})"
Expand All @@ -241,7 +251,7 @@ <h1>{{title}}</h1>
<span id="notes_{{allForms.formHistoryID}}"
onclick="getNotes({{allForms.formID.laborStatusFormID}})"
data-toggle="modal"
data-target="#NotesModal">View Notes</span></a></li>
data-target="#NotesModal">Notes</span></a></li>
{% if formType == 'preStudentApproval' %}
<li role="presentation"><a role="menuitem" href="#">
<span onclick="skipApproval({{allForms.formID.laborStatusFormID}})"
Expand Down
2 changes: 1 addition & 1 deletion app/templates/snips/pendingOverloadModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h3 class="modal-title" id="overloadModalLabel" align="center"><b>Labor Overload
########################################}
<div id="notes" style="position:absolute; right:0">
<div id="viewNotesButton">
<button id="modalNote_{{formHistoryID}}" onclick="toggleNotesLog({{laborStatusFormID}}, {{formHistoryID}})" class='btn btn-sm btn-primary'>View Notes ({{noteTotal}})</button>
<button id="modalNote_{{formHistoryID}}" onclick="toggleNotesLog({{laborStatusFormID}}, {{formHistoryID}})" class='btn btn-sm btn-primary'> Notes({{noteTotal}}) </button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/snips/pendingReleaseModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h3 class="modal-title" align="center"><strong>Labor Release Form</strong></h3>
</table>

<div id='radioDivRelease'>
<button id="modalNote_{{formHistoryID}}" onclick="toggleNotesLog({{laborStatusFormID}}, {{formHistoryID}})" style='float: left; margin-top: -10px;' class='btn btn-sm btn-primary'>View Notes ({{noteTotal}})</button>
<button id="modalNote_{{formHistoryID}}" onclick="toggleNotesLog({{laborStatusFormID}}, {{formHistoryID}})" style='float: left; margin-top: -10px;' class='btn btn-sm btn-primary'>Notes({{noteTotal}})</button>
<p class="status-warning" style="color:red;" hidden><span class="glyphicon glyphicon-exclamation-sign">
</span><strong>A Status is required in order to submit</strong></p><span>Status:<span aria-hidden="true" style="color:red"><strong>*</strong></span></span>
<label for="approveRelease" class="radio-inline">
Expand Down