mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52: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(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => 'a157f664',
|
'core.pkg.css' => 'a157f664',
|
||||||
'core.pkg.js' => 'e4556c9b',
|
'core.pkg.js' => 'da3ab00a',
|
||||||
'darkconsole.pkg.js' => 'df001cab',
|
'darkconsole.pkg.js' => 'df001cab',
|
||||||
'differential.pkg.css' => '8af45893',
|
'differential.pkg.css' => '8af45893',
|
||||||
'differential.pkg.js' => '42c10e78',
|
'differential.pkg.js' => '42c10e78',
|
||||||
|
@ -348,7 +348,7 @@ return array(
|
||||||
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
|
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
|
||||||
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
|
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
|
||||||
'rsrc/js/application/aphlict/Aphlict.js' => '4a07e8e3',
|
'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-listen.js' => 'a826c925',
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '58f7803f',
|
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '58f7803f',
|
||||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||||
|
@ -542,7 +542,7 @@ return array(
|
||||||
'inline-comment-summary-css' => '8cfd34e8',
|
'inline-comment-summary-css' => '8cfd34e8',
|
||||||
'javelin-aphlict' => '4a07e8e3',
|
'javelin-aphlict' => '4a07e8e3',
|
||||||
'javelin-behavior' => '61cbc29a',
|
'javelin-behavior' => '61cbc29a',
|
||||||
'javelin-behavior-aphlict-dropdown' => '72118e8b',
|
'javelin-behavior-aphlict-dropdown' => 'f6bc26f0',
|
||||||
'javelin-behavior-aphlict-listen' => 'a826c925',
|
'javelin-behavior-aphlict-listen' => 'a826c925',
|
||||||
'javelin-behavior-aphlict-status' => '58f7803f',
|
'javelin-behavior-aphlict-status' => '58f7803f',
|
||||||
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
|
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
|
||||||
|
@ -1278,16 +1278,6 @@ return array(
|
||||||
'phabricator-phtize',
|
'phabricator-phtize',
|
||||||
'changeset-view-manager',
|
'changeset-view-manager',
|
||||||
),
|
),
|
||||||
'72118e8b' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-request',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-vector',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-uri',
|
|
||||||
'javelin-behavior-device',
|
|
||||||
'phabricator-title',
|
|
||||||
),
|
|
||||||
'724b1247' => array(
|
'724b1247' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-typeahead-ondemand-source',
|
'javelin-typeahead-ondemand-source',
|
||||||
|
@ -1888,6 +1878,16 @@ return array(
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
'javelin-reactor',
|
'javelin-reactor',
|
||||||
),
|
),
|
||||||
|
'f6bc26f0' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-request',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-vector',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-uri',
|
||||||
|
'javelin-behavior-device',
|
||||||
|
'phabricator-title',
|
||||||
|
),
|
||||||
'f726d506' => array(
|
'f726d506' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
|
|
@ -63,17 +63,30 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
||||||
request.send();
|
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(
|
JX.Stratcom.listen(
|
||||||
'click',
|
'click',
|
||||||
null,
|
null,
|
||||||
function(e) {
|
function(e) {
|
||||||
if (!e.getNode('phabricator-notification-menu')) {
|
if (!e.getNode('phabricator-notification-menu')) {
|
||||||
// Click outside the dropdown; hide it.
|
// Click outside the dropdown; hide it.
|
||||||
JX.DOM.hide(dropdown);
|
set_visible(null);
|
||||||
if (icon) {
|
|
||||||
JX.DOM.alterClass(icon, 'white', false);
|
|
||||||
}
|
|
||||||
statics.visible = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,14 +129,13 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
||||||
// If a menu is currently open, close it.
|
// If a menu is currently open, close it.
|
||||||
if (statics.visible) {
|
if (statics.visible) {
|
||||||
var previously_visible = statics.visible;
|
var previously_visible = statics.visible;
|
||||||
JX.DOM.hide(statics.visible);
|
set_visible(null);
|
||||||
statics.visible = null;
|
|
||||||
|
|
||||||
// If the menu we just closed was the menu attached to the clicked
|
// 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
|
// 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
|
// closes it. Otherwise, we closed some other menu and still need to
|
||||||
// open the one the user just clicked.
|
// open the one the user just clicked.
|
||||||
if (previously_visible === dropdown) {
|
if (previously_visible.menu === dropdown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,11 +155,7 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
||||||
}
|
}
|
||||||
p.setPos(dropdown);
|
p.setPos(dropdown);
|
||||||
|
|
||||||
statics.visible = dropdown;
|
set_visible(dropdown, icon);
|
||||||
|
|
||||||
if (icon) {
|
|
||||||
JX.DOM.alterClass(icon, 'white', true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue