Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/views/menu/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
let selectedDay = selectedDayElement.text().trim().toLowerCase();
$('#menu-day-field').val(selectedDay);

// Set the dining hall to fetch menu for
// Set the type of meal to fetch menu for
let selectedMealType = selectedMealTypeElement.text().trim().toLowerCase();
$('#meal-type-field').val(selectedMealType);

Expand Down Expand Up @@ -101,6 +101,22 @@
$(this).removeClass('is-active');
});
$(this).parent().toggleClass('is-active');
day = $(this).parent().text().trim().toLowerCase();

// Fix the meal type if necessary
$('.meal-type-button').parent().each(function() {
if ($(this).attr('class') == 'is-active') {
isWeekend = day == 'saturday' || day == 'sunday';
isBreakfastOrLunch = $(this).attr('id') == 'breakfast-button' || $(this).attr('id') == 'lunch-button';
if (isWeekend && isBreakfastOrLunch) {
$(this).removeClass('is-active');
$('#brunch-button').toggleClass('is-active');
} else if (!isWeekend && $(this).attr('id') == 'brunch-button') {
$(this).removeClass('is-active');
$('#breakfast-button').toggleClass('is-active');
}
}
});

// Submit the form
submitMenuForm();
Expand Down