From d1a3245a25863a15afed567431b1dc44b3cb0921 Mon Sep 17 00:00:00 2001 From: nahom70 Date: Thu, 16 Jul 2026 14:20:22 -0400 Subject: [PATCH] Fixed Banned terminology on UI to ineligible and Unbanned to Eligible --- app/controllers/main/routes.py | 20 ++++++++++---------- app/static/js/userProfile.js | 12 +++++++++--- app/templates/main/userProfile.html | 12 ++++++------ 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/app/controllers/main/routes.py b/app/controllers/main/routes.py index 6f83f32dd..50c02278e 100644 --- a/app/controllers/main/routes.py +++ b/app/controllers/main/routes.py @@ -422,13 +422,13 @@ def ban(program_id, username): try: banUser(program_id, username, banNote, banEndDate, g.current_user) programInfo = Program.get(int(program_id)) - flash("Successfully banned the volunteer", "success") - createActivityLog(f'Banned {username} from {programInfo.programName} until {banEndDate}.') - return "Successfully banned the volunteer." + flash("Successfully marked the volunteer as ineligible", "success") + createActivityLog(f'Marked {username} as ineligible from {programInfo.programName} until {banEndDate}.') + return "Successfully marked the volunteer as ineligible." except Exception as e: print("Error while updating ban", e) - flash("Failed to ban the volunteer", "danger") - return "Failed to ban the volunteer", 500 + flash("Failed to mark the volunteer as ineligible", "danger") + return "Failed to mark the volunteer as ineligible", 500 # ===========================Unban=============================================== @main_bp.route('//unban/', methods=['POST']) @@ -443,14 +443,14 @@ def unban(program_id, username): try: unbanUser(program_id, username, unbanNote, g.current_user) programInfo = Program.get(int(program_id)) - createActivityLog(f'Unbanned {username} from {programInfo.programName}.') - flash("Successfully unbanned the volunteer", "success") - return "Successfully unbanned the volunteer" + createActivityLog(f'marked {username} as eligible from {programInfo.programName}.') + flash("Successfully marked the volunteer as eligible", "success") + return "Successfully marked the volunteer as eligible" except Exception as e: print("Error while updating Unban", e) - flash("Failed to unban the volunteer", "danger") - return "Failed to unban the volunteer", 500 + flash("Failed to mark the volunteer as eligible", "danger") + return "Failed to mark the volunteer as eligible", 500 @main_bp.route('//addInterest/', methods=['POST']) diff --git a/app/static/js/userProfile.js b/app/static/js/userProfile.js index 61af76787..494986116 100644 --- a/app/static/js/userProfile.js +++ b/app/static/js/userProfile.js @@ -113,19 +113,19 @@ $(document).ready(function(){ var banNote = $("#banNote") var banValue = $(this).val() - banButton.text(banValue + " Volunteer"); + banButton.text("Set " + banValue); programID = $(this).data("programid"); // Assign value to programID variable banButton.data("programID", programID) banButton.data("username", $(".banEdit").data("username")) banButton.data("banOrUnban", banValue); banEndDateDiv.show(); banEndDatepicker.val("") - $(".modal-title-ban").text(banValue + " Volunteer from "+ $(this).data("name") + "?"); + $(".modal-title-ban").text("Mark Volunteer as " + banValue + " from "+ $(this).data("name") + "?"); $("#modalProgramName").text("Program: " + $(this).data("name")); $("#banModal").modal("toggle"); $("#banNoteTxtArea").val(""); $("#banButton").prop("disabled", true); - if(banValue == "Unban"){ + if(banValue == "Eligible"){ banEndDateDiv.hide() banEndDatepicker.val("0001-01-01") //This is a placeholder value for the if statement in line 52 to work properly #PLCHLD1 banNoteDiv.show() @@ -143,6 +143,12 @@ $(document).ready(function(){ $("#banButton").prop("disabled", true) var username = $(this).data("username") //Expected to be the unique username of a user in the database var route = ($(this).data("banOrUnban")).toLowerCase() //Expected to be "ban" or "unban" + + if(route =="eligible"){ // This handles the case where the user is being marked as eligible/ineligible and changes to ban and unban status for the route + route= 'unban' + }else{ + route= 'ban' + } var program = $(this).data("programID") //Expected to be a program's primary ID $.ajax({ diff --git a/app/templates/main/userProfile.html b/app/templates/main/userProfile.html index 13fafda69..9ea0a75a5 100644 --- a/app/templates/main/userProfile.html +++ b/app/templates/main/userProfile.html @@ -234,10 +234,10 @@

{% if g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentStaff %} {% if row.isNotBanned %} Eligible - {% set label = "Ban" %} + {% set label = "Ineligible" %} {% else %} - Banned - {% set label = "Unban" %} + Ineligible + {% set label = "Eligible" %} {% endif %} {% if g.current_user.isCeltsAdmin %} @@ -639,8 +639,8 @@

Full Name: {{volunteer.firstName}} {{volunteer.lastName}}
Email Address: {{volunteer.email}}
Phone Number: {{volunteer.phoneNumber}}
-
Reason for ban:
-

Why the student was banned

+
Reason for ineligibility:
+

Why the student is ineligible

End Date:  
* @@ -654,7 +654,7 @@
End Date: &nbs