summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorRomulus Tsai 蔡仲明 <urakagi@gmail.com>2020-05-08 10:13:11 +0800
committerRomulus Tsai 蔡仲明 <urakagi@gmail.com>2020-05-08 10:13:11 +0800
commitc3458855bdb52c976ee6689ad5a0d4e92e96f2e3 (patch)
treed9dbbcc3087b5bfc520710b5f5624a3f4e2b78e6 /client/lib
parent444848876759173ad80203129250d2f0311f30fc (diff)
parentcfcc73724fcd394150d1b815d0a7a4c466e216b5 (diff)
downloadwekan-c3458855bdb52c976ee6689ad5a0d4e92e96f2e3.tar.gz
wekan-c3458855bdb52c976ee6689ad5a0d4e92e96f2e3.tar.bz2
wekan-c3458855bdb52c976ee6689ad5a0d4e92e96f2e3.zip
Merge branch 'master' into lib-change
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/datepicker.js10
-rw-r--r--client/lib/filter.js10
-rwxr-xr-xclient/lib/keyboard.js32
3 files changed, 40 insertions, 12 deletions
diff --git a/client/lib/datepicker.js b/client/lib/datepicker.js
index 8ad66c5f..aa05310c 100644
--- a/client/lib/datepicker.js
+++ b/client/lib/datepicker.js
@@ -10,12 +10,22 @@ DatePicker = BlazeComponent.extendComponent({
this.defaultTime = defaultTime;
},
+ startDayOfWeek() {
+ const currentUser = Meteor.user();
+ if (currentUser) {
+ return currentUser.getStartDayOfWeek();
+ } else {
+ return 1;
+ }
+ },
+
onRendered() {
const $picker = this.$('.js-datepicker')
.datepicker({
todayHighlight: true,
todayBtn: 'linked',
language: TAPi18n.getLanguage(),
+ weekStart: this.startDayOfWeek(),
})
.on(
'changeDate',
diff --git a/client/lib/filter.js b/client/lib/filter.js
index 592eb4ab..24ca320b 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -459,13 +459,21 @@ Filter = {
// before changing the schema.
labelIds: new SetFilter(),
members: new SetFilter(),
+ assignees: new SetFilter(),
archive: new SetFilter(),
hideEmpty: new SetFilter(),
customFields: new SetFilter('_id'),
advanced: new AdvancedFilter(),
lists: new AdvancedFilter(), // we need the ability to filter list by name as well
- _fields: ['labelIds', 'members', 'archive', 'hideEmpty', 'customFields'],
+ _fields: [
+ 'labelIds',
+ 'members',
+ 'assignees',
+ 'archive',
+ 'hideEmpty',
+ 'customFields',
+ ],
// We don't filter cards that have been added after the last filter change. To
// implement this we keep the id of these cards in this `_exceptions` fields
diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js
index da33f806..e861e416 100755
--- a/client/lib/keyboard.js
+++ b/client/lib/keyboard.js
@@ -1,6 +1,16 @@
// XXX There is no reason to define these shortcuts globally, they should be
// attached to a template (most of them will go in the `board` template).
+function getHoveredCardId() {
+ const card = $('.js-minicard:hover').get(0);
+ if (!card) return null;
+ return Blaze.getData(card)._id;
+}
+
+function getSelectedCardId() {
+ return Session.get('selectedCard') || getHoveredCardId();
+}
+
Mousetrap.bind('?', () => {
FlowRouter.go('shortcuts');
});
@@ -50,9 +60,9 @@ Mousetrap.bind(['down', 'up'], (evt, key) => {
}
});
-// XXX This shortcut should also work when hovering over a card in board view
Mousetrap.bind('space', evt => {
- if (!Session.get('currentCard')) {
+ const cardId = getSelectedCardId();
+ if (!cardId) {
return;
}
@@ -62,7 +72,7 @@ Mousetrap.bind('space', evt => {
}
if (Meteor.user().isBoardMember()) {
- const card = Cards.findOne(Session.get('currentCard'));
+ const card = Cards.findOne(cardId);
card.toggleMember(currentUserId);
// We should prevent scrolling in card when spacebar is clicked
// This should do it according to Mousetrap docs, but it doesn't
@@ -70,9 +80,9 @@ Mousetrap.bind('space', evt => {
}
});
-// XXX This shortcut should also work when hovering over a card in board view
Mousetrap.bind('c', evt => {
- if (!Session.get('currentCard')) {
+ const cardId = getSelectedCardId();
+ if (!cardId) {
return;
}
@@ -86,7 +96,7 @@ Mousetrap.bind('c', evt => {
!Meteor.user().isCommentOnly() &&
!Meteor.user().isWorker()
) {
- const card = Cards.findOne(Session.get('currentCard'));
+ const card = Cards.findOne(cardId);
card.archive();
// We should prevent scrolling in card when spacebar is clicked
// This should do it according to Mousetrap docs, but it doesn't
@@ -97,19 +107,19 @@ Mousetrap.bind('c', evt => {
Template.keyboardShortcuts.helpers({
mapping: [
{
- keys: ['W'],
+ keys: ['w'],
action: 'shortcut-toggle-sidebar',
},
{
- keys: ['Q'],
+ keys: ['q'],
action: 'shortcut-filter-my-cards',
},
{
- keys: ['F'],
+ keys: ['f'],
action: 'shortcut-toggle-filterbar',
},
{
- keys: ['X'],
+ keys: ['x'],
action: 'shortcut-clear-filters',
},
{
@@ -129,7 +139,7 @@ Template.keyboardShortcuts.helpers({
action: 'shortcut-assign-self',
},
{
- keys: ['C'],
+ keys: ['c'],
action: 'archive-card',
},
],