mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
7abdf3afe0
Summary: There are several open Differential tasks that are basically blocked on not having reasonable places in the UI to put things. Replace the "View Standalone / Raw" button with a "View Options" dropdown menu so we can shove things like "Expand All", "Fold / Unfold File", and "View in Diffusion" in there. This doesn't change any behavior, just puts the existing options in a menu. Test Plan: - Toggled menu open by clicking button. - Clicked menu items. - Toggled menu closed by clicking button. - Toggled menu closed by clicking document. - Toggled menu closed by opening another menu. - Toggled menu closed by selecting an item. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran, btrahan Maniphest Tasks: T497, T309 Differential Revision: https://secure.phabricator.com/D1316
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-differential-dropdown-menus
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-stratcom
|
|
* phabricator-dropdown-menu
|
|
* phabricator-menu-item
|
|
*/
|
|
|
|
JX.behavior('differential-dropdown-menus', function(config) {
|
|
|
|
function standalone(button) {
|
|
return function() {
|
|
window.open(JX.Stratcom.getData(button).detailURI);
|
|
}
|
|
}
|
|
|
|
function left_file(button) {
|
|
return function() {
|
|
window.open(JX.Stratcom.getData(button).leftURI);
|
|
}
|
|
}
|
|
|
|
function right_file(button) {
|
|
return function() {
|
|
window.open(JX.Stratcom.getData(button).rightURI);
|
|
}
|
|
}
|
|
|
|
var buttons = JX.DOM.scry(window.document, 'a', 'differential-view-options');
|
|
for (var ii = 0; ii < buttons.length; ii++) {
|
|
var button = buttons[ii];
|
|
new JX.PhabricatorDropdownMenu(buttons[ii])
|
|
.addItem(
|
|
new JX.PhabricatorMenuItem(
|
|
'View Standalone',
|
|
standalone(button)))
|
|
.addItem(
|
|
new JX.PhabricatorMenuItem(
|
|
'Show Raw File (Left)',
|
|
left_file(button)))
|
|
.addItem(
|
|
new JX.PhabricatorMenuItem(
|
|
'Show Raw File (Right)',
|
|
right_file(button)));
|
|
}
|
|
|
|
});
|