From 7ed43cdad2695094fef82f055919724233f30a43 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 24 Jul 2016 11:05:25 +0200 Subject: [PATCH] Avoid displaying the date in the column container when the user is on single day view. --- src/assets/js/backend_calendar_table_view.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/assets/js/backend_calendar_table_view.js b/src/assets/js/backend_calendar_table_view.js index 2addf00c..159c6973 100644 --- a/src/assets/js/backend_calendar_table_view.js +++ b/src/assets/js/backend_calendar_table_view.js @@ -401,6 +401,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; function _createView(startDate, endDate) { $('#calendar .calendar-view').remove(); + var displayDate = startDate.getTime() !== endDate.getTime(); var $calendarView = $('
').appendTo('#calendar'); $calendarView.data({ @@ -419,7 +420,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; var currentDate = startDate; while(currentDate <= endDate) { - _createDateColumn($wrapper, currentDate, response); + _createDateColumn($wrapper, currentDate, response, displayDate); currentDate.add({days: 1}); } @@ -436,13 +437,16 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; * @param {jQuery} $wrapper The wrapper div element of the table view. * @param {Date} date Selected date for the column. * @param {Object[]} events Events to be displayed on this date. + * @param {Boolean} displayDate Whether to display the date in the column container. */ - function _createDateColumn($wrapper, date, events) { + function _createDateColumn($wrapper, date, events, displayDate) { var $dateColumn = $('
').appendTo($wrapper); - $dateColumn - .data('date', date.getTime()) - .append('
' + GeneralFunctions.formatDate(date, GlobalVariables.dateFormat) + '
'); + $dateColumn.data('date', date.getTime()); + + if (displayDate) { + $dateColumn.append('
' + GeneralFunctions.formatDate(date, GlobalVariables.dateFormat) + '
'); + } var providers = GlobalVariables.availableProviders;