From cc3ba89ab3012825dca5b546e7e0b03213eea40c Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 21 Aug 2017 15:07:21 +0300 Subject: [PATCH] calendar dashlet month title --- client/modules/crm/src/views/calendar/calendar.js | 11 ++++++++++- client/modules/crm/src/views/calendar/timeline.js | 10 ++++++++-- client/modules/crm/src/views/dashlets/calendar.js | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/client/modules/crm/src/views/calendar/calendar.js b/client/modules/crm/src/views/calendar/calendar.js index 505ca1edbf..9f73e08589 100644 --- a/client/modules/crm/src/views/calendar/calendar.js +++ b/client/modules/crm/src/views/calendar/calendar.js @@ -196,6 +196,14 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi this.$el.find('button[data-action="today"]').removeClass('active'); } + var title = this.getTitle(); + + this.$el.find('.date-title h4 span').text(title); + }, + + getTitle: function () { + var view = this.$calendar.fullCalendar('getView'); + var map = { 'agendaWeek': 'week', 'agendaDay': 'day', @@ -215,7 +223,8 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi if (this.options.userId && this.options.userName) { title += ' (' + this.options.userName + ')'; } - this.$el.find('.date-title h4 span').text(title); + + return title; }, convertToFcEvent: function (o) { diff --git a/client/modules/crm/src/views/calendar/timeline.js b/client/modules/crm/src/views/calendar/timeline.js index 9084fe6f28..757b184aab 100644 --- a/client/modules/crm/src/views/calendar/timeline.js +++ b/client/modules/crm/src/views/calendar/timeline.js @@ -281,12 +281,18 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V if (!this.header) { return; } - var title; + + var title = this.getTitle(); + this.$el.find('.date-title h4 span').text(title); + }, + + getTitle: function () { + var title = ''; if (this.options.userId && this.options.userName) { title += ' (' + this.options.userName + ')'; } - this.$el.find('.date-title h4 span').text(title); + return title; }, convertEvent: function (o) { diff --git a/client/modules/crm/src/views/dashlets/calendar.js b/client/modules/crm/src/views/dashlets/calendar.js index 6bd5a0e026..a7107a3f2c 100644 --- a/client/modules/crm/src/views/dashlets/calendar.js +++ b/client/modules/crm/src/views/dashlets/calendar.js @@ -70,7 +70,16 @@ Espo.define('crm:views/dashlets/calendar', 'views/dashlets/abstract/base', funct enabledScopeList: this.getOption('enabledScopeList'), containerSelector: this.options.el }, function (view) { + this.listenTo(view, 'view', function () { + if (this.getOption('mode') === 'month') { + var title = this.getOption('title'); + var $headerSpan = this.$el.closest('.panel').find('.panel-heading > .panel-title > span'); + title += ' » ' + view.getTitle(); + $headerSpan.html(title); + } + }, this); view.render(); + this.on('resize', function () { setTimeout(function() { view.adjustSize();