diff options
author | Marc Hartmayer <hello@hartmayer.com> | 2020-04-22 14:44:08 +0200 |
---|---|---|
committer | Marc Hartmayer <hello@hartmayer.com> | 2020-04-22 19:16:05 +0200 |
commit | 8e14459cff4da1391f536dfbc6441abb21e9c215 (patch) | |
tree | c25c0eeb010635a9771754a067ab9c0f0d1c8997 /client/components/users/userHeader.js | |
parent | 3ac5dba243a9896adc5db6fdc586c8b1768f2df9 (diff) | |
download | wekan-8e14459cff4da1391f536dfbc6441abb21e9c215.tar.gz wekan-8e14459cff4da1391f536dfbc6441abb21e9c215.tar.bz2 wekan-8e14459cff4da1391f536dfbc6441abb21e9c215.zip |
Implement option to change the first day of week in user settings
Implements #2535.
Diffstat (limited to 'client/components/users/userHeader.js')
-rw-r--r-- | client/components/users/userHeader.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index cd315bd6..5298e99a 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -224,6 +224,27 @@ Template.changeSettingsPopup.helpers({ return cookies.get('limitToShowCardsCount'); } }, + weekDays(startDay) { + return [ + TAPi18n.__('sunday'), + TAPi18n.__('monday'), + TAPi18n.__('tuesday'), + TAPi18n.__('wednesday'), + TAPi18n.__('thursday'), + TAPi18n.__('friday'), + TAPi18n.__('saturday'), + ].map(function(day, index) { + return { name: day, value: index, isSelected: index === startDay }; + }); + }, + startDayOfWeek() { + currentUser = Meteor.user(); + if (currentUser) { + return currentUser.getStartDayOfWeek(); + } else { + return cookies.get('startDayOfWeek'); + } + }, }); Template.changeSettingsPopup.events({ @@ -263,4 +284,20 @@ Template.changeSettingsPopup.events({ Popup.back(); } }, + 'click .js-apply-start-day-of-week'(event, templateInstance) { + event.preventDefault(); + const startDay = parseInt( + templateInstance.$('#start-day-of-week').val(), + 10, + ); + if (!isNaN(startDay)) { + currentUser = Meteor.user(); + if (currentUser) { + Meteor.call('changeStartDayOfWeek', startDay); + } else { + cookies.set('startDayOfWeek', startDay); + } + Popup.back(); + } + }, }); |