-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Main Table UI Changes #1886
Merged
Merged
Main Table UI Changes #1886
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b97deaa
Start Manage Submissions
lykimchee 33180b3
Center checkbox in manage submission table (#1868)
michellexliu 0c60bd3
Main Table UI
lykimchee 2a2ee2b
Updates with selecting students and buttons
lykimchee 68ba4fd
Add Score Popup Icon
lykimchee 32ab637
Icon spacing and codebase style
lykimchee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,49 @@ | ||
var hideStudent; | ||
|
||
$(document).ready(function() { | ||
|
||
$.fn.dataTable.ext.search.push( | ||
function(settings, data, dataIndex) { | ||
var filterOnlyLatest = $("#only-latest").is(':checked'); | ||
if (!filterOnlyLatest) { | ||
// if not filtered, return all the rows | ||
return true; | ||
} else { | ||
var isSubmissionLatest = data[8]; // use data for the age column | ||
return (isSubmissionLatest == "true"); | ||
} | ||
} | ||
); | ||
|
||
var $floater = $("#floater"), | ||
$backdrop = $("#gradeBackdrop"); | ||
$('.trigger').bind('ajax:success', function showStudent(event, data, status, xhr) { | ||
$floater.html(data); | ||
$floater.show(); | ||
$backdrop.show(); | ||
}); | ||
|
||
/** override the global **/ | ||
hideStudent = function hideStudent() { | ||
$floater.hide(); | ||
$backdrop.hide(); | ||
}; | ||
// USE LATER FOR GROUPING ROWS (POSSIBLY): | ||
|
||
// $.fn.dataTable.ext.search.push( | ||
// function(settings, data, dataIndex) { | ||
// var filterOnlyLatest = $("#only-latest").is(':checked'); | ||
// if (!filterOnlyLatest) { | ||
// // if not filtered, return all the rows | ||
// return true; | ||
// } else { | ||
// var isSubmissionLatest = data[8]; // use data for the age column | ||
// return (isSubmissionLatest == "true"); | ||
// } | ||
// } | ||
// ); | ||
|
||
var table = $('#submissions').DataTable({ | ||
'sPaginationType': 'full_numbers', | ||
'iDisplayLength': 100, | ||
'oLanguage': { | ||
'sLengthMenu':'<label><input type="checkbox" id="only-latest">' + | ||
'<span>Show only latest</span></label>' | ||
}, | ||
"columnDefs": [{ | ||
"targets": [8], | ||
"visible": false, | ||
// "searchable": false | ||
}], | ||
"aaSorting": [ | ||
[4, "desc"] | ||
"dom": 'fBrt', // show buttons, search, table | ||
buttons: [ | ||
{ text: '<i class="material-icons">cached</i>Regrade Selected', className: 'btn submissions-selected disabled' }, | ||
{ text: '<i class="material-icons">delete_outline</i>Delete Selected', className: 'btn submissions-selected disabled' }, | ||
{ text: '<i class="material-icons">download</i>Download Selected', className: 'btn submissions-selected disabled' }, | ||
{ text: '<i class="material-icons">done</i>Excuse Selected', className: 'btn submissions-selected disabled' } | ||
] | ||
}); | ||
|
||
$("#only-latest").on("change", function() { | ||
table.draw(); | ||
}); | ||
|
||
var ids = []; | ||
$("input[type='checkbox']:checked").each(function() { | ||
ids.push($(this).val()); | ||
}); | ||
|
||
var selectedSubmissions = []; | ||
|
||
var initialBatchUrl = $("#batch-regrade").prop("href"); | ||
// USE LATER FOR REGRADE SELECTED (POSSIBLY): | ||
|
||
function updateBatchRegradeButton() { | ||
// var initialBatchUrl = $("#batch-regrade").prop("href"); | ||
|
||
if (selectedSubmissions.length == 0) { | ||
$("#batch-regrade").fadeOut(120); | ||
} else { | ||
$("#batch-regrade").fadeIn(120); | ||
} | ||
var urlParam = $.param({ | ||
"submission_ids": selectedSubmissions | ||
}); | ||
var newHref = initialBatchUrl + "?" + urlParam; | ||
$("#batch-regrade").html("Regrade " + selectedSubmissions.length + " Submissions") | ||
$("#batch-regrade").prop("href", newHref); | ||
}; | ||
// function updateBatchRegradeButton() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this similarly as well |
||
// if (selectedSubmissions.length == 0) { | ||
// $("#batch-regrade").fadeOut(120); | ||
// } else { | ||
// $("#batch-regrade").fadeIn(120); | ||
// } | ||
// var urlParam = $.param({ | ||
// "submission_ids": selectedSubmissions | ||
// }); | ||
// var newHref = initialBatchUrl + "?" + urlParam; | ||
// $("#batch-regrade").html("Regrade " + selectedSubmissions.length + " Submissions") | ||
// $("#batch-regrade").prop("href", newHref); | ||
// }; | ||
|
||
function toggleRow(submissionId) { | ||
if (selectedSubmissions.indexOf(submissionId) < 0) { | ||
|
@@ -86,26 +57,14 @@ $(document).ready(function() { | |
$("#row-" + submissionId).removeClass("selected"); | ||
selectedSubmissions = _.without(selectedSubmissions, submissionId); | ||
} | ||
|
||
updateBatchRegradeButton(); | ||
// updateBatchRegradeButton(); | ||
} | ||
|
||
$("#submissions").on("click", ".exclude-click i", function (e) { | ||
e.stopPropagation(); | ||
return; | ||
}); | ||
|
||
$('#submissions').on("click", ".submission-row", function(e) { | ||
// Don't toggle row if we originally clicked on an anchor and input tag | ||
if(e.target.localName != 'a' && e.target.localName !='input') { | ||
// e.target: tightest element that triggered the event | ||
// e.currentTarget: element the event has bubbled up to currently | ||
var submissionId = parseInt(e.currentTarget.id.replace("row-", ""), 10); | ||
toggleRow(submissionId); | ||
return false; | ||
} | ||
}); | ||
|
||
$('#submissions').on("click", ".cbox", function(e) { | ||
var submissionId = parseInt(e.currentTarget.id.replace("cbox-", ""), 10); | ||
toggleRow(submissionId); | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michellexliu or @lykimchee whoever is working on the group would need to make sure to remove this line eventually