Skip to content

Commit

Permalink
Fix schedule info from being larger than table
Browse files Browse the repository at this point in the history
- Fix schedule info from being larger than table
- Workaround for libraries-fi/kirkanta#12
- Removed scope from th
  • Loading branch information
olli-suutari-jkl committed Jun 5, 2019
1 parent 0605a1d commit cf21de2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
25 changes: 18 additions & 7 deletions js/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ function getWeekSchelude(direction, lib) {
schedulesAreAvailable = false;
}
else {
$("#weekSchelude").replaceWith('<tbody id="weekSchelude" class="schedules-weekly">');
dayInfo = '<tr class="info-span info-text">' +
'<td colspan="2"><span id="scheduleInfo" class="info-span info-text"><i class="fa fa-info-circle" > ' +
'</i> ' + i18n.get("No schedules") + '</span></td></tr>';
$("#weekSchelude").append(dayInfo);
$("#scheduleInfos").replaceWith('<tbody id="scheduleInfos" class="schedule-infos">' +
'<tr id="scheduleInfoRow">' +
'<td colspan="3"><span id="scheduleInfo" class="info-span-lg info-text"><i class="fa fa-info-circle" > ' +
'</i> ' + i18n.get("No schedules") + '</span></td></tr>');
$('#weekSchelude').css("display", "none");
//$("#weekSchelude").append(dayInfo);
isScheduleEmpty = true;
}
}
Expand Down Expand Up @@ -259,7 +260,6 @@ function getWeekSchelude(direction, lib) {
// Capitalize 1st letter of dayname.
var dayName = begin.format("dddd");
dayName = dayName[0].toUpperCase() + dayName.substr(1);

function increaseRowCount(isInfo) {
// Increase rowspanCount to be used with DD.M. for each open section.
rowspanCount = rowspanCount + 1;
Expand Down Expand Up @@ -294,6 +294,7 @@ function getWeekSchelude(direction, lib) {
'</tr>';
increaseRowCount(true);
}
var lastStatusIsStaff = false;
for (var t = 0; t < schedules[i].times.length; t++) {
var time = schedules[i].times[t];
var from = time.from;
Expand All @@ -311,7 +312,17 @@ function getWeekSchelude(direction, lib) {
2 means the library is in self-service mode (no staff).
*/
if(time.status !== 0) {
increaseRowCount();
if(time.status == 1) {
// https://github.com/libraries-fi/kirkanta/issues/12 | Don't increase row count for overlapping staff presents.
if(!lastStatusIsStaff) {
increaseRowCount();
lastStatusIsStaff = true;
}
}
else {
increaseRowCount();
lastStatusIsStaff = false;
}
}
if (time.status === 1) {
staffPresentStart = from;
Expand Down
13 changes: 12 additions & 1 deletion style/schedule.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@
/* Media query for IE 10-11. Fixes schedule table being larger than the container */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.normal-schedules table, .schedules-widget table {
table-layout: fixed;
word-break: break-all;
table-layout: fixed;
width: 100%;
}
}

.normal-schedules .date-container, .schedules-widget .date-container {
width: auto;
padding-right: 5%;
padding-top: 4px;
}

.normal-schedules td, .schedules-widget td {
word-wrap: break-word;
word-break: break-word;
}

@media screen and (max-width: 499px) {
.normal-schedules {
margin-left: calc(50% - 48.33vw);
Expand Down

0 comments on commit cf21de2

Please sign in to comment.