save calendar view

This commit is contained in:
yuri
2015-05-05 11:30:29 +03:00
parent c0c77e6e6b
commit 3067abcac2
2 changed files with 10 additions and 2 deletions
@@ -28,9 +28,13 @@ Espo.define('Crm:Views.Calendar.CalendarPage', 'View', function (Dep) {
el: '#main',
setup: function () {
var mode = this.options.mode || null;
if (!mode) {
var mode = this.getStorage().get('state', 'calendarMode') || null;
}
this.createView('calendar', 'Crm:Calendar.Calendar', {
date: this.options.date,
mode: this.options.mode,
mode: mode,
el: '#main > .calendar-container',
}, function (view) {
var first = true;
@@ -39,7 +43,10 @@ Espo.define('Crm:Views.Calendar.CalendarPage', 'View', function (Dep) {
this.getRouter().navigate('#Calendar/show/date=' + date + '&mode=' + mode);
}
first = false;
}.bind(this));
}, this);
this.listenTo(view, 'change:mode', function (mode) {
this.getStorage().set('state', 'calendarMode', mode);
}, this);
}.bind(this));
},
@@ -80,6 +80,7 @@ Espo.define('Crm:Views.Calendar.Calendar', ['View', 'lib!FullCalendar'], functio
this.$el.find('button[data-mode="' + mode + '"]').addClass('active');
this.$calendar.fullCalendar('changeView', mode);
this.updateDate();
this.trigger('change:mode', mode);
},
'click [data-action="refresh"]': function (e) {
this.$calendar.fullCalendar('refetchEvents');