Skip to content

Commit

Permalink
Fix the highlighting of the moderator directory cell (#3733)
Browse files Browse the repository at this point in the history
  • Loading branch information
willgearty authored Mar 20, 2024
1 parent 6b09ede commit 9501fab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 13 additions & 2 deletions esp/public/media/scripts/ajaxschedulingmodule/ESP/Moderators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = "<td>" + this.moderator.first_name + " " + this.moderator.last_name +
this.el.attr('id', "moderator_" + this.moderator.id);
this.el[0].innerHTML = "<td>" + this.moderator.first_name + " " + this.moderator.last_name +
"</br><a target='_blank' href='" + baseURL +
"edit_availability?user=" + this.moderator.username +
"'>Edit Availability</a>" + " <a target='_blank' href='/manage/userview?username=" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ function Scheduler(
// set up handler for selecting moderators
$j("body").on("click", "td.moderator-cell", function(evt, ui) {
var moderatorCell = $j(evt.currentTarget).data("moderatorCell");
this.moderatorDirectory.selectedModeratorCell = moderatorCell;
this.moderatorDirectory.selectModerator(moderatorCell.moderator);
}.bind(this));

Expand Down

0 comments on commit 9501fab

Please sign in to comment.