summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorIgnatzHome <ignatz@maschath.de>2018-06-14 20:38:10 +0200
committerIgnatzHome <ignatz@maschath.de>2018-06-14 20:38:10 +0200
commitb5e6e6ee10b34a2ddfc94fa31447658a484148ad (patch)
tree5d1f9acaf3f8667e795ad4dc1194a50ed4b74050 /client
parent61ee6cf09fd4829136c598bcfce25b5e522d0097 (diff)
parent8a7ad0df54b1664f2fc540fb9e33835d697e185f (diff)
downloadwekan-b5e6e6ee10b34a2ddfc94fa31447658a484148ad.tar.gz
wekan-b5e6e6ee10b34a2ddfc94fa31447658a484148ad.tar.bz2
wekan-b5e6e6ee10b34a2ddfc94fa31447658a484148ad.zip
Merge branch 'devel' of https://github.com/wekan/wekan into feature-custom-fields
Diffstat (limited to 'client')
-rw-r--r--client/components/cards/cardDate.js20
-rw-r--r--client/components/cards/minicard.jade2
-rw-r--r--client/lib/filter.js196
3 files changed, 111 insertions, 107 deletions
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index e95c3a23..c3e0524d 100644
--- a/client/components/cards/cardDate.js
+++ b/client/components/cards/cardDate.js
@@ -279,14 +279,18 @@ class CardDueDate extends CardDate {
classes() {
let classes = 'due-date' + ' ';
- if ((this.now.get().diff(this.date.get(), 'days') >= 2) &&
+ // if endAt exists & is < dueAt, dueAt doesn't need to be flagged
+ if ((this.data().endAt !== 0) &&
+ (this.data().endAt !== null) &&
+ (this.data().endAt !== '') &&
+ (this.data().endAt !== undefined) &&
(this.date.get().isBefore(this.data().endAt)))
+ classes += 'current';
+ else if (this.now.get().diff(this.date.get(), 'days') >= 2)
classes += 'long-overdue';
- else if ((this.now.get().diff(this.date.get(), 'minute') >= 0) &&
- (this.date.get().isBefore(this.data().endAt)))
+ else if (this.now.get().diff(this.date.get(), 'minute') >= 0)
classes += 'due';
- else if ((this.now.get().diff(this.date.get(), 'days') >= -1) &&
- (this.date.get().isBefore(this.data().endAt)))
+ else if (this.now.get().diff(this.date.get(), 'days') >= -1)
classes += 'almost-due';
return classes;
}
@@ -316,10 +320,10 @@ class CardEndDate extends CardDate {
let classes = 'end-date' + ' ';
if (this.data.dueAt.diff(this.date.get(), 'days') >= 2)
classes += 'long-overdue';
- else if (this.data.dueAt.diff(this.date.get(), 'days') >= 0)
+ else if (this.data.dueAt.diff(this.date.get(), 'days') > 0)
classes += 'due';
- else if (this.data.dueAt.diff(this.date.get(), 'days') >= -2)
- classes += 'almost-due';
+ else if (this.data.dueAt.diff(this.date.get(), 'days') <= 0)
+ classes += 'current';
return classes;
}
diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade
index c912ea70..2a8e95ab 100644
--- a/client/components/cards/minicard.jade
+++ b/client/components/cards/minicard.jade
@@ -15,7 +15,7 @@ template(name="minicard")
unless dueAt
unless endAt
.date
- +miniCardReceivedDate
+ +minicardReceivedDate
if startAt
.date
+minicardStartDate
diff --git a/client/lib/filter.js b/client/lib/filter.js
index ea1811de..e3658e1e 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -149,11 +149,11 @@ class AdvancedFilter {
{
const found = CustomFields.findOne({ 'name': field });
if (found.settings.dropdownItems && found.settings.dropdownItems.length > 0)
- {
+ {
for (let i = 0; i < found.settings.dropdownItems.length; i++)
- {
+ {
if (found.settings.dropdownItems[i].name === value)
- {
+ {
return found.settings.dropdownItems[i]._id;
}
}
@@ -179,27 +179,27 @@ class AdvancedFilter {
if (commands[i].cmd) {
switch (commands[i].cmd) {
case '(':
- {
- level++;
- if (start === -1) start = i;
- continue;
- }
+ {
+ level++;
+ if (start === -1) start = i;
+ continue;
+ }
case ')':
- {
- level--;
+ {
+ level--;
+ commands.splice(i, 1);
+ i--;
+ continue;
+ }
+ default:
+ {
+ if (level > 0) {
+ subcommands.push(commands[i]);
commands.splice(i, 1);
i--;
continue;
}
- default:
- {
- if (level > 0) {
- subcommands.push(commands[i]);
- commands.splice(i, 1);
- i--;
- continue;
- }
- }
+ }
}
}
}
@@ -221,86 +221,86 @@ class AdvancedFilter {
case '=':
case '==':
case '===':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case '!=':
case '!==':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case '>':
case 'gt':
case 'Gt':
case 'GT':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case '>=':
case '>==':
case 'gte':
case 'Gte':
case 'GTE':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case '<':
case 'lt':
case 'Lt':
case 'LT':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case '<=':
case '<==':
case 'lte':
case 'Lte':
case 'LTE':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
}
}
@@ -316,44 +316,44 @@ class AdvancedFilter {
case 'OR':
case '|':
case '||':
- {
- const op1 = commands[i - 1];
- const op2 = commands[i + 1];
- commands[i] = { $or: [op1, op2] };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const op1 = commands[i - 1];
+ const op2 = commands[i + 1];
+ commands[i] = { $or: [op1, op2] };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case 'and':
case 'And':
case 'AND':
case '&':
case '&&':
- {
- const op1 = commands[i - 1];
- const op2 = commands[i + 1];
- commands[i] = { $and: [op1, op2] };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
+ {
+ const op1 = commands[i - 1];
+ const op2 = commands[i + 1];
+ commands[i] = { $and: [op1, op2] };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
case 'not':
case 'Not':
case 'NOT':
case '!':
- {
- const op1 = commands[i + 1];
- commands[i] = { $not: op1 };
- commands.splice(i + 1, 1);
+ {
+ const op1 = commands[i + 1];
+ commands[i] = { $not: op1 };
+ commands.splice(i + 1, 1);
//changed = true;
- i--;
- break;
- }
+ i--;
+ break;
+ }
}
}