mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
a5b3e33e3c
Summary: Ref T10335. When you (for example) drag a "Resolved" task into a column with "Trigger: change status to resolved.", don't show a hint that the action will "Change status to resolved." since this isn't helpful and is somewhat confusing. For now, the only visibility operator is "!=" since all current actions are simple field comparisons, but some actions in the future (like "add subscriber" or "remove project") might need other conditions. Test Plan: Dragged cards in ways that previously provided useless hints: move from column A to column B on a "Group by Priority" board; drag a resolved task to a "Trigger: change status to as resolved" column. Saw a more accurate preview in both cases. Drags which actually cause effects still show the effects correctly. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T10335 Differential Revision: https://secure.phabricator.com/D20300
63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
/**
|
|
* @provides javelin-workboard-drop-effect
|
|
* @requires javelin-install
|
|
* javelin-dom
|
|
* @javelin
|
|
*/
|
|
|
|
JX.install('WorkboardDropEffect', {
|
|
|
|
properties: {
|
|
icon: null,
|
|
color: null,
|
|
content: null,
|
|
conditions: []
|
|
},
|
|
|
|
statics: {
|
|
newFromDictionary: function(map) {
|
|
return new JX.WorkboardDropEffect()
|
|
.setIcon(map.icon)
|
|
.setColor(map.color)
|
|
.setContent(JX.$H(map.content))
|
|
.setConditions(map.conditions || []);
|
|
}
|
|
},
|
|
|
|
members: {
|
|
newNode: function() {
|
|
var icon = new JX.PHUIXIconView()
|
|
.setIcon(this.getIcon())
|
|
.setColor(this.getColor())
|
|
.getNode();
|
|
|
|
return JX.$N('li', {}, [icon, this.getContent()]);
|
|
},
|
|
|
|
isEffectVisibleForCard: function(card) {
|
|
var conditions = this.getConditions();
|
|
|
|
var properties = card.getProperties();
|
|
for (var ii = 0; ii < conditions.length; ii++) {
|
|
var condition = conditions[ii];
|
|
|
|
var field = properties[condition.field];
|
|
var value = condition.value;
|
|
|
|
var result = true;
|
|
switch (condition.operator) {
|
|
case '!=':
|
|
result = (field !== value);
|
|
break;
|
|
}
|
|
|
|
if (!result) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|
|
});
|