mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 02:12:41 +01:00
1277db9452
Summary: Ref T5474. The first rough cut of triggers showed some of the trigger rules in a tooltip when you hover over the "add/remove" trigger menu. This isn't great since we don't have much room and it's a bit finnicky / hard to read. Since we have a better way to show effects now in the drop preview, just use that instead. When you hover over the trigger menu, preview the trigger in the "drop effect" element, with a "Trigger: such-and-such" header. Test Plan: - This is pretty tough to screenshot. - Hovered over menu, got a sensible preview of the trigger effects. - Dragged a card over the menu, no preview. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T5474 Differential Revision: https://secure.phabricator.com/D20304
73 lines
1.5 KiB
JavaScript
73 lines
1.5 KiB
JavaScript
/**
|
|
* @provides javelin-workboard-drop-effect
|
|
* @requires javelin-install
|
|
* javelin-dom
|
|
* @javelin
|
|
*/
|
|
|
|
JX.install('WorkboardDropEffect', {
|
|
|
|
properties: {
|
|
icon: null,
|
|
color: null,
|
|
content: null,
|
|
isTriggerEffect: false,
|
|
isHeader: false,
|
|
conditions: []
|
|
},
|
|
|
|
statics: {
|
|
newFromDictionary: function(map) {
|
|
return new JX.WorkboardDropEffect()
|
|
.setIcon(map.icon)
|
|
.setColor(map.color)
|
|
.setContent(JX.$H(map.content))
|
|
.setIsTriggerEffect(map.isTriggerEffect)
|
|
.setIsHeader(map.isHeader)
|
|
.setConditions(map.conditions || []);
|
|
}
|
|
},
|
|
|
|
members: {
|
|
newNode: function() {
|
|
var icon = new JX.PHUIXIconView()
|
|
.setIcon(this.getIcon())
|
|
.setColor(this.getColor())
|
|
.getNode();
|
|
|
|
var attributes = {};
|
|
|
|
if (this.getIsHeader()) {
|
|
attributes.className = 'workboard-drop-preview-header';
|
|
}
|
|
|
|
return JX.$N('li', attributes, [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;
|
|
}
|
|
|
|
}
|
|
});
|