Remember calendar view
parent
e202713fb3
commit
aed2cbc5eb
|
@ -640,7 +640,9 @@ Messages.calendar_allDay = "All day";
|
||||||
}
|
}
|
||||||
APP.toolbar.$bottomM.empty().append(h('div', date));
|
APP.toolbar.$bottomM.empty().append(h('div', date));
|
||||||
};
|
};
|
||||||
var makeCalendar = function () {
|
var makeCalendar = function (view) {
|
||||||
|
var store = window.cryptpadStore;
|
||||||
|
|
||||||
var $container = $('#cp-sidebarlayout-container');
|
var $container = $('#cp-sidebarlayout-container');
|
||||||
var leftside;
|
var leftside;
|
||||||
$container.append([
|
$container.append([
|
||||||
|
@ -649,7 +651,7 @@ Messages.calendar_allDay = "All day";
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var cal = APP.calendar = new Calendar('#cp-sidebarlayout-rightside', {
|
var cal = APP.calendar = new Calendar('#cp-sidebarlayout-rightside', {
|
||||||
defaultView: 'week', // weekly view option
|
defaultView: view || 'week', // weekly view option
|
||||||
taskView: false,
|
taskView: false,
|
||||||
useCreationPopup: true,
|
useCreationPopup: true,
|
||||||
useDetailPopup: true,
|
useDetailPopup: true,
|
||||||
|
@ -754,12 +756,13 @@ Messages.calendar_allDay = "All day";
|
||||||
left: true,
|
left: true,
|
||||||
};
|
};
|
||||||
var $block = UIElements.createDropdown(dropdownConfig);
|
var $block = UIElements.createDropdown(dropdownConfig);
|
||||||
$block.setValue('week');
|
$block.setValue(view || 'week');
|
||||||
var $views = $block.find('a');
|
var $views = $block.find('a');
|
||||||
$views.click(function () {
|
$views.click(function () {
|
||||||
var mode = $(this).attr('data-value');
|
var mode = $(this).attr('data-value');
|
||||||
cal.changeView(mode);
|
cal.changeView(mode);
|
||||||
updateDateRange();
|
updateDateRange();
|
||||||
|
store.put('calendarView', mode, function () {});
|
||||||
});
|
});
|
||||||
APP.toolbar.$bottomR.append($block);
|
APP.toolbar.$bottomR.append($block);
|
||||||
|
|
||||||
|
@ -933,6 +936,7 @@ Messages.calendar_allDay = "All day";
|
||||||
APP.module = common.makeUniversal('calendar', {
|
APP.module = common.makeUniversal('calendar', {
|
||||||
onEvent: onEvent
|
onEvent: onEvent
|
||||||
});
|
});
|
||||||
|
var store = window.cryptpadStore;
|
||||||
APP.module.execCommand('SUBSCRIBE', null, function (obj) {
|
APP.module.execCommand('SUBSCRIBE', null, function (obj) {
|
||||||
if (obj.empty && !privateData.calendarHash) {
|
if (obj.empty && !privateData.calendarHash) {
|
||||||
// No calendar yet, create one
|
// No calendar yet, create one
|
||||||
|
@ -943,7 +947,7 @@ Messages.calendar_allDay = "All day";
|
||||||
title: Messages.calendar_default
|
title: Messages.calendar_default
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
if (err) { return void UI.errorLoadingScreen(Messages.error); } // XXX
|
if (err) { return void UI.errorLoadingScreen(Messages.error); } // XXX
|
||||||
makeCalendar();
|
store.get('calendarView', makeCalendar);
|
||||||
UI.removeLoadingScreen();
|
UI.removeLoadingScreen();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -956,7 +960,7 @@ Messages.calendar_allDay = "All day";
|
||||||
if (obj && obj.error) { console.error(obj.error); }
|
if (obj && obj.error) { console.error(obj.error); }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
makeCalendar();
|
store.get('calendarView', makeCalendar);
|
||||||
UI.removeLoadingScreen();
|
UI.removeLoadingScreen();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue