Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Commit

Permalink
Merge branch 'staging' into master.
Browse files Browse the repository at this point in the history
- Fixes the search bar bug
- Re-adds missing course title tooltipss on the schedule
  • Loading branch information
copperwater committed Sep 27, 2016
2 parents 4c9e612 + 5cd44ee commit 6817698
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 2 additions & 6 deletions app/assets/javascripts/views/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Yacs.views.index = function () {
var key = event.keyCode;
if (!(event.ctrlKey || event.metaKey)) {
if ((key >= 48 && key <= 105) || key == 32) {
if (key == 127 && searchbar.value.length <= 1)
Yacs.views.departments(content);
// normal keys focus the searchbar
searchbar.focus();
} else if (key == 13) {
// enter searches
if (searchbar.value) {
Yacs.models.courses.query({ search: searchbar.value,
show_sections: true,
Expand All @@ -37,11 +37,7 @@ Yacs.views.index = function () {
if (success)
Yacs.views.courses(content, data);
});
} else {
Yacs.views.departments(content);
}
} else if ((key == 8 || key == 46) && searchbar.value.length <= 1) {
Yacs.views.departments(content);
}
}
});
Expand Down
10 changes: 6 additions & 4 deletions app/assets/javascripts/views/schedules.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Yacs.views.schedule = function (target) {
section.department_code + ' ' + section.course_number + ' - ' + section.name,
section.crn,
section.instructors[0] || ''
]
],
tooltip: section.course_name,
});
});
});
Expand All @@ -80,7 +81,7 @@ Yacs.views.schedule = function (target) {
var data = processSchedules(schedules);
scheduleData = data.schedules;
schedule.destroy();
schedule = new Schedule(scheduleElement,
schedule = new Schedule(scheduleElement,
{ timeBegin: Math.ceil((data.start) / 60) * 60,
timeSpan: Math.ceil((data.end - data.start) / 60) * 60 });
scheduleCountElement.textContent = scheduleData.length;
Expand Down Expand Up @@ -130,9 +131,10 @@ Yacs.views.schedule = function (target) {
scheduleStatusElement.textContent = "";
scheduleNumElement.textContent = 0;
} else {
schedule.setEvents(scheduleData[index].events)
schedule.setEvents(scheduleData[index].events);
scheduleNumElement.textContent = index + 1;
scheduleStatusElement.textContent = 'CRNs: ' + scheduleData[index].crns.join(', ');
scheduleStatusStr = 'CRNs: ' + scheduleData[index].crns.join(', ');
scheduleStatusElement.textContent = scheduleStatusStr;
}
};

Expand Down
4 changes: 4 additions & 0 deletions vendor/assets/javascripts/schedule/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ window.Schedule = function (scheduleContainer, options) {
eventElement.style.borderColor = BORDER_COLORS[colorIndex];
eventBackground.style.backgroundColor = BACKGROUND_COLORS[colorIndex];

if ('tooltip' in event) {
eventElement.title = event.tooltip;
}

eventElement.appendChild(eventBackground);
eventElement.appendChild(eventText);
scheduleElement.appendChild(eventElement);
Expand Down

0 comments on commit 6817698

Please sign in to comment.