-
Notifications
You must be signed in to change notification settings - Fork 14
Graduation management first page #1679
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
Changes from 27 commits
11fc7da
7f7db93
f97f9f3
11a372e
fa303f1
79180c3
fb6af41
12ebcff
d977e8a
0009316
286cee0
a3ee57d
8fb9053
2440ebb
c42cd9d
1fe7b84
2680d7b
f922a9c
2ac2493
dda493d
b6ee7f9
9a1a508
ed8d721
8e66c28
ca10c2f
866151a
e8de989
d1ef839
c71d2c0
e1ec401
40c5d07
5ab4f46
175149e
e378566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,8 +18,7 @@ $(document).ready(function() { | |
| return true; | ||
| }); | ||
|
|
||
| $('.graduated-checkbox').not('.hasHandler').addClass("hasHandler") | ||
| $('.graduated-checkbox').change(checkboxClickHandler); | ||
| $(document).on('change', '.graduated-checkbox', checkboxClickHandler); | ||
|
|
||
| initializePage() | ||
|
|
||
|
|
@@ -123,9 +122,7 @@ $(document).ready(function() { | |
| } | ||
|
|
||
| function redrawTable() { | ||
| gradStudentsTable.draw(); | ||
| $('.graduated-checkbox').not('.hasHandler').change(checkboxClickHandler); | ||
| $('.graduated-checkbox').not('.hasHandler').addClass("hasHandler") | ||
| gradStudentsTable.draw(); | ||
| } | ||
|
|
||
| function checkboxClickHandler() { | ||
|
|
@@ -137,20 +134,22 @@ $(document).ready(function() { | |
| data: {status: hasGraduated ? 1 : 0}, | ||
| url: `/${username}/setGraduationStatus`, | ||
| success: function(response) { | ||
| initializePage() | ||
| msgFlash(`Saved graduation status for ${username}.`, "success", 1000) | ||
| const row = $(`tr[data-username="${username}"]`); | ||
| var currentPage = gradStudentsTable.page(); | ||
| if (hasGraduated) { | ||
| row.data('status', 'alumni'); | ||
| $(`#${username}ClassLevel`).text("Alumni"); | ||
| if (!showGraduatedStudents()) { | ||
| row.addClass('hidden'); | ||
| redrawTable(); | ||
| } | ||
| } else { | ||
| row.data('status', 'enrolled'); | ||
| $(`#${username}ClassLevel`).text("Senior"); | ||
| row.removeClass('hidden'); | ||
| } | ||
| gradStudentsTable.draw(); | ||
| gradStudentsTable.page(currentPage).draw(false); | ||
|
Contributor
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. Line 152 shouldn't be necessary, you are redrawing the table, putting it on the page, then redrawing it again it seems. You could just remove this line then change the line above it to be:
Contributor
Author
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. I have now simplified the last two lines of the above code to be only: gradStudentsTable.draw(false) and verified that it still works properly after. |
||
| }, | ||
| error: function(status, error) { | ||
| console.error("Error updating graduation status:", error); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.