From e202713fb3f69f876f262293b6693288fc7a68af Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 13 Apr 2021 15:37:09 +0200 Subject: [PATCH 1/2] Add missing translation key --- www/calendar/inner.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 830674341..030d77677 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -59,6 +59,7 @@ Messages.calendar_day = "Day"; Messages.calendar_week = "Week"; Messages.calendar_month = "Month"; Messages.calendar_today = "Today"; +Messages.calendar_more = "{0} more"; Messages.calendar_deleteConfirm = "Are you sure you want to delete this calendar from your account?"; Messages.calendar_deleteTeamConfirm = "Are you sure you want to delete this calendar from this team?"; Messages.calendar_deleteOwned = " It will still be visible for the users it has been shared with."; @@ -225,6 +226,9 @@ Messages.calendar_allDay = "All day"; })()) { getTime = undefined; } var templates = { + monthGridHeaderExceed: function(hiddenSchedules) { + return '' + Messages._getKey('calendar_more', [hiddenSchedules]) + ''; + }, popupSave: function () { return Messages.settings_save; }, popupUpdate: function() { return Messages.calendar_update; }, popupEdit: function() { return Messages.poll_edit; }, From aed2cbc5ebf07922f1a5106828abbde85393d884 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 13 Apr 2021 15:42:04 +0200 Subject: [PATCH 2/2] Remember calendar view --- www/calendar/inner.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 030d77677..331785987 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -640,7 +640,9 @@ Messages.calendar_allDay = "All day"; } 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 leftside; $container.append([ @@ -649,7 +651,7 @@ Messages.calendar_allDay = "All day"; ]); var cal = APP.calendar = new Calendar('#cp-sidebarlayout-rightside', { - defaultView: 'week', // weekly view option + defaultView: view || 'week', // weekly view option taskView: false, useCreationPopup: true, useDetailPopup: true, @@ -754,12 +756,13 @@ Messages.calendar_allDay = "All day"; left: true, }; var $block = UIElements.createDropdown(dropdownConfig); - $block.setValue('week'); + $block.setValue(view || 'week'); var $views = $block.find('a'); $views.click(function () { var mode = $(this).attr('data-value'); cal.changeView(mode); updateDateRange(); + store.put('calendarView', mode, function () {}); }); APP.toolbar.$bottomR.append($block); @@ -933,6 +936,7 @@ Messages.calendar_allDay = "All day"; APP.module = common.makeUniversal('calendar', { onEvent: onEvent }); + var store = window.cryptpadStore; APP.module.execCommand('SUBSCRIBE', null, function (obj) { if (obj.empty && !privateData.calendarHash) { // No calendar yet, create one @@ -943,7 +947,7 @@ Messages.calendar_allDay = "All day"; title: Messages.calendar_default }, function (err) { if (err) { return void UI.errorLoadingScreen(Messages.error); } // XXX - makeCalendar(); + store.get('calendarView', makeCalendar); UI.removeLoadingScreen(); }); return; @@ -956,7 +960,7 @@ Messages.calendar_allDay = "All day"; if (obj && obj.error) { console.error(obj.error); } }); } - makeCalendar(); + store.get('calendarView', makeCalendar); UI.removeLoadingScreen(); });