From 955466d156f2c45f8973beadfdb349a67c9a1472 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 17 Nov 2015 20:19:47 +0000 Subject: [PATCH] Fix some layout / formatting problems with 12h times --- calendar/js/app.js | 2 +- calendar/js/et2_widget_event.js | 6 +++--- calendar/js/et2_widget_planner.js | 4 ++-- calendar/js/et2_widget_timegrid.js | 6 +++--- calendar/templates/default/app.css | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index 0d5ba62a55..18753b986e 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -2454,7 +2454,7 @@ app.classes.calendar = AppJS.extend( var range = ''; var datefmt = egw.preference('dateformat'); - var timefmt = egw.preference('timeformat') == 12 ? 'h:i a' : 'H:i'; + var timefmt = egw.preference('timeformat') === '12' ? 'h:i a' : 'H:i'; var month_before_day = datefmt[0].toLowerCase() == 'm' || datefmt[2].toLowerCase() == 'm' && datefmt[4] == 'd'; diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index 31cf60ccb6..f440400153 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -433,7 +433,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], if (event['end_m'] > 24*60) { timespan = jQuery.datepicker.formatTime( - egw.preference("timeformat") === 12 ? "h:mmtt" : "HH:mm", + egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: event.start_m / 60, minute: event.start_m % 60, @@ -442,7 +442,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], }, {"ampm": (egw.preference("timeformat") === "12")} ).trim()+' - '+jQuery.datepicker.formatTime( - egw.preference("timeformat") === 12 ? "h:mmtt" : "HH:mm", + egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: event.end_m / 60, minute: event.end_m % 60, @@ -464,7 +464,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], duration = Math.floor(duration/60) + this.egw().lang('h')+(duration%60 ? duration%60 : ''); timespan = jQuery.datepicker.formatTime( - egw.preference("timeformat") === 12 ? "h:mmtt" : "HH:mm", + egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: event.start_m / 60, minute: event.start_m % 60, diff --git a/calendar/js/et2_widget_planner.js b/calendar/js/et2_widget_planner.js index 17c9ca9a0b..391560a65d 100644 --- a/calendar/js/et2_widget_planner.js +++ b/calendar/js/et2_widget_planner.js @@ -1414,14 +1414,14 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize var time = this._get_time_from_position(position.left, position.top); element.dropEnd = time; var formatted_time = jQuery.datepicker.formatTime( - egw.preference("timeformat") == 12 ? "h:mmtt" : "HH:mm", + egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: time.getUTCHours(), minute: time.getUTCMinutes(), seconds: 0, timezone: 0 }, - {"ampm": (egw.preference("timeformat") == "12")} + {"ampm": (egw.preference("timeformat") === "12")} ); element.innerHTML = '
'+formatted_time+'
'; diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index 8344378a7d..1ae7e20d36 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -339,7 +339,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz else { time = jQuery.datepicker.formatTime( - egw.preference("timeformat") == 12 ? "h:mmtt" : "HH:mm", + egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: element.dropEnd.attr('data-hour'), minute: element.dropEnd.attr('data-minute'), @@ -606,14 +606,14 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz html += '
'; // show time for full hours, always for 45min interval and at least on every 3 row var time = jQuery.datepicker.formatTime( - egw.preference("timeformat") == 12 ? "h:mmtt" : "HH:mm", + egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: t / 60, minute: t % 60, seconds: 0, timezone: 0 }, - {"ampm": (egw.preference("timeformat") == "12")} + {"ampm": (egw.preference("timeformat") === "12")} ); if(t <= wd_start && t + granularity > wd_start) { diff --git a/calendar/templates/default/app.css b/calendar/templates/default/app.css index e001253fdc..0b6032fe74 100644 --- a/calendar/templates/default/app.css +++ b/calendar/templates/default/app.css @@ -194,7 +194,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget top: 0px; /* bottom: 0px; does NOT work in IE, IE needs height: 100%! */ height: 100%; - left: 45px; + left: 58px; right: 0px; white-space: nowrap; } @@ -301,7 +301,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget .calendar_calGridHeader > div { position: relative; height: 100%; - margin-left: 42px; + margin-left: 55px; width: initial; white-space: nowrap; border-left: 1px solid silver;