Skip to content

Commit

Permalink
some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
otrok7 committed Sep 20, 2024
1 parent b45817d commit c1ccbe5
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions croutonjs/src/js/crouton-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ function Crouton(config) {
jQuery(id).removeClass("hide").addClass("show");
};

self.showView = function (viewName) {
self.showView = function (viewName, resetFilters=true) {
if (resetFilters) {
self.resetFilter();
}
if (viewName === "byday") {
self.byDayView();
} else if (viewName === "day" || viewName === "weekday") {
Expand All @@ -339,7 +342,6 @@ function Crouton(config) {
};

self.byDayView = function () {
self.resetFilter();
self.lowlightButton(".filterButton");
self.highlightButton("#day");
jQuery('.bmlt-page').each(function (index) {
Expand All @@ -351,7 +353,6 @@ function Crouton(config) {
};

self.dayView = function () {
self.resetFilter();
self.lowlightButton(".filterButton");
self.highlightButton("#day");
jQuery('.bmlt-page').each(function (index) {
Expand All @@ -363,10 +364,7 @@ function Crouton(config) {
});
};

self.filteredView = function (field, resetFilters=true) {
if (resetFilters) {
self.resetFilter();
}
self.filteredView = function (field) {
self.lowlightButton("#day");
self.lowlightButton(".filterButton");
self.highlightButton("#filterButton_" + field);
Expand Down Expand Up @@ -409,8 +407,6 @@ function Crouton(config) {
});
if (!filteringDropdown) {
self.filtering = false;
if (croutonMap) croutonMap.fillMap();
return;
}
var showingNow = [];
jQuery(".bmlt-data-row").not(".hide").each(function (index, value) {
Expand Down Expand Up @@ -1745,7 +1741,7 @@ Crouton.prototype.simulateFilterDropdown = function() {
});
self.filteredPage();
if (!self.filtering && !self.config.map_page)
self.showView(self.config['view_by'] === 'byday' ? 'byday' : 'day');
self.showView(self.config['view_by'] === 'byday' ? 'byday' : 'day', false);
}
Crouton.prototype.getAdjustedDateTime = function(meeting_day, meeting_time, meeting_time_zone) {
var timeZoneAware = this.config['auto_tz_adjust'] === true || this.config['auto_tz_adjust'] === "true";
Expand Down

0 comments on commit c1ccbe5

Please sign in to comment.