1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/webroot/rsrc/js/phui/behavior-phui-timeline-dropdown-menu.js
epriestley bfc1ccfdf1 Move all comment management junk into a dropdown menu
Summary:
man I sure hate Javascript

I removed the ajax-edit and ajax-remove interactions, becuase they were prohibitively complex to get working given that the entire menu has to change too. Instead, the page just reloads. This works perfectly fine in practice.

If we want to restore these in the future, we should have the server re-render the entire transaction group or something. I think very little is lost here, though.

Test Plan:
  - Took all the actions.
  - Used existing dropdown menus.

{F150196}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8966
2014-05-05 10:57:23 -07:00

34 lines
784 B
JavaScript

/**
* @provides javelin-behavior-phui-timeline-dropdown-menu
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
* phuix-dropdown-menu
*/
JX.behavior('phui-timeline-dropdown-menu', function() {
JX.Stratcom.listen('click', 'phui-timeline-menu', function(e) {
var data = e.getNodeData('phui-timeline-menu');
if (data.menu) {
return;
}
e.kill();
var list = JX.$H(data.items).getFragment().firstChild;
var icon = e.getNode('phui-timeline-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();
});
});
});