Avoid displaying the date in the column container when the user is on single day view.

This commit is contained in:
Alex Tselegidis 2016-07-24 11:05:25 +02:00
parent 4b976c86fe
commit 7ed43cdad2

View file

@ -401,6 +401,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
function _createView(startDate, endDate) { function _createView(startDate, endDate) {
$('#calendar .calendar-view').remove(); $('#calendar .calendar-view').remove();
var displayDate = startDate.getTime() !== endDate.getTime();
var $calendarView = $('<div class="calendar-view" />').appendTo('#calendar'); var $calendarView = $('<div class="calendar-view" />').appendTo('#calendar');
$calendarView.data({ $calendarView.data({
@ -419,7 +420,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var currentDate = startDate; var currentDate = startDate;
while(currentDate <= endDate) { while(currentDate <= endDate) {
_createDateColumn($wrapper, currentDate, response); _createDateColumn($wrapper, currentDate, response, displayDate);
currentDate.add({days: 1}); currentDate.add({days: 1});
} }
@ -436,13 +437,16 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
* @param {jQuery} $wrapper The wrapper div element of the table view. * @param {jQuery} $wrapper The wrapper div element of the table view.
* @param {Date} date Selected date for the column. * @param {Date} date Selected date for the column.
* @param {Object[]} events Events to be displayed on this date. * @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 = $('<div class="date-column" />').appendTo($wrapper); var $dateColumn = $('<div class="date-column" />').appendTo($wrapper);
$dateColumn $dateColumn.data('date', date.getTime());
.data('date', date.getTime())
.append('<h5>' + GeneralFunctions.formatDate(date, GlobalVariables.dateFormat) + '</h5>'); if (displayDate) {
$dateColumn.append('<h5>' + GeneralFunctions.formatDate(date, GlobalVariables.dateFormat) + '</h5>');
}
var providers = GlobalVariables.availableProviders; var providers = GlobalVariables.availableProviders;