mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 10:42:41 +01:00
4622993885
Summary: Fixes T8150. Small generalization: - Timeline has a dropdown with no special logic; make that generic. - Use it in Phriction. Test Plan: - Used Phriction dropdown on desktop and mobile. - Used timeline dropdown. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8150 Differential Revision: https://secure.phabricator.com/D12931
34 lines
766 B
JavaScript
34 lines
766 B
JavaScript
/**
|
|
* @provides javelin-behavior-phui-dropdown-menu
|
|
* @requires javelin-behavior
|
|
* javelin-stratcom
|
|
* javelin-dom
|
|
* phuix-dropdown-menu
|
|
*/
|
|
|
|
JX.behavior('phui-dropdown-menu', function() {
|
|
|
|
JX.Stratcom.listen('click', 'phui-dropdown-menu', function(e) {
|
|
var data = e.getNodeData('phui-dropdown-menu');
|
|
if (data.menu) {
|
|
return;
|
|
}
|
|
|
|
e.kill();
|
|
|
|
var list = JX.$H(data.items).getFragment().firstChild;
|
|
|
|
var icon = e.getNode('phui-dropdown-menu');
|
|
data.menu = new JX.PHUIXDropdownMenu(icon);
|
|
data.menu.setContent(list);
|
|
data.menu.open();
|
|
|
|
JX.DOM.listen(list, 'click', 'tag:a', function(e) {
|
|
if (!e.isNormalClick()) {
|
|
return;
|
|
}
|
|
data.menu.close();
|
|
});
|
|
});
|
|
|
|
});
|