summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/datepicker.js13
-rw-r--r--client/lib/filter.js14
-rw-r--r--client/lib/textComplete.js1
-rw-r--r--client/lib/utils.js72
4 files changed, 85 insertions, 15 deletions
diff --git a/client/lib/datepicker.js b/client/lib/datepicker.js
index eb5b60b8..8ad66c5f 100644
--- a/client/lib/datepicker.js
+++ b/client/lib/datepicker.js
@@ -3,10 +3,11 @@ DatePicker = BlazeComponent.extendComponent({
return 'datepicker';
},
- onCreated() {
+ onCreated(defaultTime = '1970-01-01 08:00:00') {
this.error = new ReactiveVar('');
this.card = this.data();
this.date = new ReactiveVar(moment.invalid());
+ this.defaultTime = defaultTime;
},
onRendered() {
@@ -21,7 +22,15 @@ DatePicker = BlazeComponent.extendComponent({
function(evt) {
this.find('#date').value = moment(evt.date).format('L');
this.error.set('');
- this.find('#time').focus();
+ const timeInput = this.find('#time');
+ timeInput.focus();
+ if (!timeInput.value) {
+ const currentHour = evt.date.getHours();
+ const defaultMoment = moment(
+ currentHour > 0 ? evt.date : this.defaultTime,
+ ); // default to 8:00 am local time
+ timeInput.value = defaultMoment.format('LT');
+ }
}.bind(this),
);
diff --git a/client/lib/filter.js b/client/lib/filter.js
index 1ca3a280..592eb4ab 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -439,6 +439,14 @@ class AdvancedFilter {
const commands = this._filterToCommands();
return this._arrayToSelector(commands);
}
+ getRegexSelector() {
+ // generate a regex for filter list
+ this._dep.depend();
+ return new RegExp(
+ `^.*${this._filter.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*$`,
+ 'i',
+ );
+ }
}
// The global Filter object.
@@ -455,6 +463,7 @@ Filter = {
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'],
@@ -468,7 +477,9 @@ Filter = {
return (
_.any(this._fields, fieldName => {
return this[fieldName]._isActive();
- }) || this.advanced._isActive()
+ }) ||
+ this.advanced._isActive() ||
+ this.lists._isActive()
);
},
@@ -533,6 +544,7 @@ Filter = {
const filter = this[fieldName];
filter.reset();
});
+ this.lists.reset();
this.advanced.reset();
this.resetExceptions();
},
diff --git a/client/lib/textComplete.js b/client/lib/textComplete.js
index 0261d7f6..8b6dc1f7 100644
--- a/client/lib/textComplete.js
+++ b/client/lib/textComplete.js
@@ -45,6 +45,7 @@ $.fn.escapeableTextComplete = function(strategies, options, ...otherArgs) {
});
},
});
+ return this;
};
EscapeActions.register('textcomplete', () => {}, () => dropdownMenuIsOpened, {
diff --git a/client/lib/utils.js b/client/lib/utils.js
index 81835929..c90dd749 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -1,10 +1,59 @@
Utils = {
+ setBoardView(view) {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ currentUser = Meteor.user();
+ if (currentUser) {
+ Meteor.user().setBoardView(view);
+ } else if (view === 'board-view-lists') {
+ cookies.set('boardView', 'board-view-lists'); //true
+ } else if (view === 'board-view-swimlanes') {
+ cookies.set('boardView', 'board-view-swimlanes'); //true
+ //} else if (view === 'board-view-collapse') {
+ // cookies.set('boardView', 'board-view-swimlane'); //true
+ // cookies.set('collapseSwimlane', 'true'); //true
+ } else if (view === 'board-view-cal') {
+ cookies.set('boardView', 'board-view-cal'); //true
+ }
+ },
+
+ unsetBoardView() {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ cookies.remove('boardView');
+ cookies.remove('collapseSwimlane');
+ },
+
+ boardView() {
+ currentUser = Meteor.user();
+ if (currentUser) {
+ return (currentUser.profile || {}).boardView;
+ } else {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ if (cookies.get('boardView') === 'board-view-lists') {
+ return 'board-view-lists';
+ } else if (
+ cookies.get('boardView') === 'board-view-swimlanes'
+ //&& !cookies.has('collapseSwimlane')
+ ) {
+ return 'board-view-swimlanes';
+ //} else if (cookies.has('collapseSwimlane')) {
+ // return 'board-view-swimlanes';
+ } else if (cookies.get('boardView') === 'board-view-cal') {
+ return 'board-view-cal';
+ } else {
+ return false;
+ }
+ }
+ },
+
// XXX We should remove these two methods
goBoardId(_id) {
const board = Boards.findOne(_id);
return (
- board &&
- FlowRouter.go('board', {
+ board
+ && FlowRouter.go('board', {
id: board._id,
slug: board.slug,
})
@@ -15,15 +64,14 @@ Utils = {
const card = Cards.findOne(_id);
const board = Boards.findOne(card.boardId);
return (
- board &&
- FlowRouter.go('card', {
+ board
+ && FlowRouter.go('card', {
cardId: card._id,
boardId: board._id,
slug: board.slug,
})
);
},
-
MAX_IMAGE_PIXEL: Meteor.settings.public.MAX_IMAGE_PIXEL,
COMPRESS_RATIO: Meteor.settings.public.IMAGE_COMPRESS_RATIO,
processUploadedAttachment(card, fileObj, callback) {
@@ -188,8 +236,8 @@ Utils = {
};
if (
- 'ontouchstart' in window ||
- (window.DocumentTouch && document instanceof window.DocumentTouch)
+ 'ontouchstart' in window
+ || (window.DocumentTouch && document instanceof window.DocumentTouch)
) {
return true;
}
@@ -210,8 +258,8 @@ Utils = {
calculateTouchDistance(touchA, touchB) {
return Math.sqrt(
- Math.pow(touchA.screenX - touchB.screenX, 2) +
- Math.pow(touchA.screenY - touchB.screenY, 2),
+ Math.pow(touchA.screenX - touchB.screenX, 2)
+ + Math.pow(touchA.screenY - touchB.screenY, 2),
);
},
@@ -228,9 +276,9 @@ Utils = {
});
$(document).on('touchend', selector, function(e) {
if (
- touchStart &&
- lastTouch &&
- Utils.calculateTouchDistance(touchStart, lastTouch) <= 20
+ touchStart
+ && lastTouch
+ && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20
) {
e.preventDefault();
const clickEvent = document.createEvent('MouseEvents');