From 9501fab37c828a0c2d26b4d2f4d86b97ecfe0085 Mon Sep 17 00:00:00 2001 From: William Gearty Date: Tue, 19 Mar 2024 20:35:34 -0400 Subject: [PATCH] Fix the highlighting of the moderator directory cell (#3733) --- .../ajaxschedulingmodule/ESP/Moderators.js | 15 +++++++++++++-- .../scripts/ajaxschedulingmodule/ESP/Scheduler.js | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/esp/public/media/scripts/ajaxschedulingmodule/ESP/Moderators.js b/esp/public/media/scripts/ajaxschedulingmodule/ESP/Moderators.js index a468ff48bd..c3ad62f142 100644 --- a/esp/public/media/scripts/ajaxschedulingmodule/ESP/Moderators.js +++ b/esp/public/media/scripts/ajaxschedulingmodule/ESP/Moderators.js @@ -170,6 +170,15 @@ function ModeratorDirectory(el, moderators) { return moderators[moderator_id]; }; + /** + * Get the directory cell for a moderator + * + * @param moderator: A moderator object + */ + this.getModeratorCell = function(moderator) { + return $j("[id='moderator_" + moderator.id + "']").data("moderatorCell"); + }; + /** * Calculate a moderator's number of available slots (based on the moderator form and their existing assignments) * @param moderator: A moderator object @@ -244,7 +253,8 @@ function ModeratorDirectory(el, moderators) { } this.selectedModerator = moderator; - if(this.selectedModeratorCell) this.selectedModeratorCell.el.addClass("selected-moderator"); + this.selectedModeratorCell = this.getModeratorCell(moderator); + this.selectedModeratorCell.el.addClass("selected-moderator"); this.matrix.sectionInfoPanel.displayModerator(moderator); this.availableTimeslots = this.getAvailableTimeslots(moderator); this.matrix.highlightTimeslots(this.availableTimeslots, null, moderator); @@ -396,7 +406,8 @@ function ModeratorCell(el, moderator, matrix) { this.el.addClass("moderator-cell"); var baseURL = this.matrix.sections.getBaseUrlString(); - this.el[0].innerHTML = this.el[0].innerHTML = "" + this.moderator.first_name + " " + this.moderator.last_name + + this.el.attr('id', "moderator_" + this.moderator.id); + this.el[0].innerHTML = "" + this.moderator.first_name + " " + this.moderator.last_name + "
Edit Availability" + "