mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Implement more correct white-icon menu behavior
Summary: I didn't get this quite right. Test Plan: - Clicked to open, saw white, then closed by: - Clicking document outside menu; - clicking menu icon again; - clicking a different menu icon. - In all three cases, got correct close + un-white behavior. Reviewers: chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D10967
This commit is contained in:
parent
eb9c3c6663
commit
3297bc2ed9
2 changed files with 34 additions and 26 deletions
|
@ -8,7 +8,7 @@
|
|||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => 'a157f664',
|
||||
'core.pkg.js' => 'e4556c9b',
|
||||
'core.pkg.js' => 'da3ab00a',
|
||||
'darkconsole.pkg.js' => 'df001cab',
|
||||
'differential.pkg.css' => '8af45893',
|
||||
'differential.pkg.js' => '42c10e78',
|
||||
|
@ -348,7 +348,7 @@ return array(
|
|||
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
|
||||
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
|
||||
'rsrc/js/application/aphlict/Aphlict.js' => '4a07e8e3',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '72118e8b',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'f6bc26f0',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'a826c925',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '58f7803f',
|
||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||
|
@ -542,7 +542,7 @@ return array(
|
|||
'inline-comment-summary-css' => '8cfd34e8',
|
||||
'javelin-aphlict' => '4a07e8e3',
|
||||
'javelin-behavior' => '61cbc29a',
|
||||
'javelin-behavior-aphlict-dropdown' => '72118e8b',
|
||||
'javelin-behavior-aphlict-dropdown' => 'f6bc26f0',
|
||||
'javelin-behavior-aphlict-listen' => 'a826c925',
|
||||
'javelin-behavior-aphlict-status' => '58f7803f',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
|
||||
|
@ -1278,16 +1278,6 @@ return array(
|
|||
'phabricator-phtize',
|
||||
'changeset-view-manager',
|
||||
),
|
||||
'72118e8b' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-request',
|
||||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
'javelin-dom',
|
||||
'javelin-uri',
|
||||
'javelin-behavior-device',
|
||||
'phabricator-title',
|
||||
),
|
||||
'724b1247' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-typeahead-ondemand-source',
|
||||
|
@ -1888,6 +1878,16 @@ return array(
|
|||
'javelin-util',
|
||||
'javelin-reactor',
|
||||
),
|
||||
'f6bc26f0' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-request',
|
||||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
'javelin-dom',
|
||||
'javelin-uri',
|
||||
'javelin-behavior-device',
|
||||
'phabricator-title',
|
||||
),
|
||||
'f726d506' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
|
|
@ -63,17 +63,30 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
|||
request.send();
|
||||
}
|
||||
|
||||
function set_visible(menu, icon) {
|
||||
if (menu) {
|
||||
statics.visible = {menu: menu, icon: icon};
|
||||
if (icon) {
|
||||
JX.DOM.alterClass(icon, 'white', true);
|
||||
}
|
||||
} else {
|
||||
if (statics.visible) {
|
||||
JX.DOM.hide(statics.visible.menu);
|
||||
if (statics.visible.icon) {
|
||||
JX.DOM.alterClass(statics.visible.icon, 'white', false);
|
||||
}
|
||||
}
|
||||
statics.visible = null;
|
||||
}
|
||||
}
|
||||
|
||||
JX.Stratcom.listen(
|
||||
'click',
|
||||
null,
|
||||
function(e) {
|
||||
if (!e.getNode('phabricator-notification-menu')) {
|
||||
// Click outside the dropdown; hide it.
|
||||
JX.DOM.hide(dropdown);
|
||||
if (icon) {
|
||||
JX.DOM.alterClass(icon, 'white', false);
|
||||
}
|
||||
statics.visible = null;
|
||||
set_visible(null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -116,14 +129,13 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
|||
// If a menu is currently open, close it.
|
||||
if (statics.visible) {
|
||||
var previously_visible = statics.visible;
|
||||
JX.DOM.hide(statics.visible);
|
||||
statics.visible = null;
|
||||
set_visible(null);
|
||||
|
||||
// If the menu we just closed was the menu attached to the clicked
|
||||
// icon, we're all done -- clicking the icon for an open menu just
|
||||
// closes it. Otherwise, we closed some other menu and still need to
|
||||
// open the one the user just clicked.
|
||||
if (previously_visible === dropdown) {
|
||||
if (previously_visible.menu === dropdown) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -143,11 +155,7 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
|||
}
|
||||
p.setPos(dropdown);
|
||||
|
||||
statics.visible = dropdown;
|
||||
|
||||
if (icon) {
|
||||
JX.DOM.alterClass(icon, 'white', true);
|
||||
}
|
||||
set_visible(dropdown, icon);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue