From 5a5a1ca444a329bec7061c10d0e8c1ec4bb7d33c Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 5 May 2014 10:57:08 -0700 Subject: [PATCH] Delete all old dropdown menu code Summary: Everything is on PHUIX now, so get rid of the old stuff which had standalone CSS. Test Plan: `grep` Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D8977 --- resources/celerity/packages.php | 5 +- webroot/rsrc/css/core/z-index.css | 1 - webroot/rsrc/css/phui/phui-button.css | 31 ---- webroot/rsrc/js/core/DropdownMenu.js | 192 ----------------------- webroot/rsrc/js/core/DropdownMenuItem.js | 56 ------- 5 files changed, 3 insertions(+), 282 deletions(-) delete mode 100644 webroot/rsrc/js/core/DropdownMenu.js delete mode 100644 webroot/rsrc/js/core/DropdownMenuItem.js diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index a7c0c52d52..7444c9daa4 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -33,8 +33,9 @@ return array( 'javelin-behavior-refresh-csrf', 'javelin-behavior-phabricator-watch-anchor', 'javelin-behavior-phabricator-autofocus', - 'phabricator-menu-item', - 'phabricator-dropdown-menu', + 'phuix-dropdown-menu', + 'phuix-action-list-view', + 'phuix-action-view', 'phabricator-phtize', 'javelin-behavior-phabricator-oncopy', 'phabricator-tooltip', diff --git a/webroot/rsrc/css/core/z-index.css b/webroot/rsrc/css/core/z-index.css index 94d636298f..1059d315d0 100644 --- a/webroot/rsrc/css/core/z-index.css +++ b/webroot/rsrc/css/core/z-index.css @@ -133,7 +133,6 @@ div.jx-typeahead-results { z-index: 20; } -.dropdown-menu-frame, .phuix-dropdown-menu { z-index: 32; } diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index a504457b3a..7a5a048be1 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -166,7 +166,6 @@ button.link:hover { text-decoration: underline; } -.dropdown-menu-frame, .phuix-dropdown-menu { position: absolute; width: 240px; @@ -178,25 +177,6 @@ button.link:hover { border-bottom-color: {$greyborder}; } -.dropdown-menu-frame .dropdown-menu-item { - display: block; - padding: 2px 10px; - clear: both; - line-height: 20px; - color: {$darkgreytext}; - white-space: nowrap; -} - -.dropdown-menu-frame .dropdown-menu-item-disabled { - color: {$lightgreytext}; -} - -.dropdown-menu-frame .phui-icon-view { - display: inline-block; - padding: 0; - margin: 2px 6px -2px 4px; -} - a.policy-control { width: 240px; text-align: left; @@ -213,17 +193,6 @@ a.policy-control span.phui-icon-view { left: 7px; } -.dropdown-menu-frame .dropdown-menu-item-selected { - background: {$lightblue}; -} - -.dropdown-menu-frame a:hover { - background: {$blue}; - color: white; - cursor: pointer; - text-decoration: none; -} - a.toggle { display: inline-block; padding: 4px 8px; diff --git a/webroot/rsrc/js/core/DropdownMenu.js b/webroot/rsrc/js/core/DropdownMenu.js deleted file mode 100644 index 490e92e223..0000000000 --- a/webroot/rsrc/js/core/DropdownMenu.js +++ /dev/null @@ -1,192 +0,0 @@ -/** - * @requires javelin-install - * javelin-util - * javelin-dom - * javelin-vector - * javelin-stratcom - * phabricator-menu-item - * @provides phabricator-dropdown-menu - * @javelin - */ - -JX.install('PhabricatorDropdownMenu', { - - construct : function(node) { - this._node = node; - this._items = []; - this._menu = JX.$N('div', { className : 'dropdown-menu-frame' }); - - JX.DOM.listen( - this._node, - 'click', - null, - JX.bind(this, this._onclick)); - - JX.DOM.listen( - this._menu, - 'click', - null, - JX.bind(this, this._onclickitem)); - - JX.Stratcom.listen( - 'mousedown', - null, - JX.bind(this, this._onclickglobal)); - - JX.Stratcom.listen( - 'resize', - null, - JX.bind(this, this._onresize)); - - JX.PhabricatorDropdownMenu.listen( - 'open', - JX.bind(this, this.close)); - }, - - events : ['open'], - - properties : { - width : null - }, - - members : { - _node : null, - _menu : null, - _open : false, - _items : null, - _alignRight : true, - - // By default, the dropdown will have its right edge aligned with the - // right edge of _node. Making this false does left edge alignment - toggleAlignDropdownRight : function (bool) { - this._alignRight = bool; - }, - - open : function() { - if (this._open) { - return; - } - - this.invoke('open'); - - var menu_items = []; - for (var ii = 0; ii < this._items.length; ii++) { - menu_items.push(this._items[ii].render()); - } - JX.DOM.setContent(this._menu, menu_items); - - this._open = true; - this._show(); - - return this; - }, - - close : function() { - if (!this._open) { - return; - } - this._open = false; - this._hide(); - - return this; - }, - - clear : function() { - this._items = []; - return this; - }, - - addItem : function(item) { - if (__DEV__) { - if (!(item instanceof JX.PhabricatorMenuItem)) { - JX.$E( - 'JX.DropdownMenu.addItem(): ' + - 'item must be a JX.PhabricatorMenuItem.'); - } - } - this._items.push(item); - return this; - }, - - _onclick : function(e) { - if (this._open) { - this.close(); - } else { - this.open(); - } - e.prevent(); - }, - - _onclickitem : function(e) { - var item = JX.Stratcom.getData(e.getTarget()).item; - if (!item) { - return; - } - - if (item.getDisabled()) { - e.prevent(); - return; - } - - item.select(); - e.prevent(); - this.close(); - }, - - _onclickglobal : function(e) { - if (!this._open) { - return; - } - - if (JX.Stratcom.pass(e)) { - return; - } - - var t = e.getTarget(); - while (t) { - if (t == this._menu || t == this._node) { - return; - } - t = t.parentNode; - } - - this.close(); - }, - - _show : function() { - document.body.appendChild(this._menu); - - if (this.getWidth()) { - new JX.Vector(this.getWidth(), null).setDim(this._menu); - } - - this._onresize(); - - JX.DOM.alterClass(this._node, 'dropdown-open', true); - }, - - _onresize : function() { - if (!this._open) { - return; - } - - var m = JX.Vector.getDim(this._menu); - - var v = JX.$V(this._node); - var d = JX.Vector.getDim(this._node); - if (this._alignRight) { - v = v.add(d) - .add(JX.$V(-m.x, 0)); - } else { - v = v.add(0, d.y); - } - v.setPos(this._menu); - }, - - _hide : function() { - JX.DOM.remove(this._menu); - JX.DOM.alterClass(this._node, 'dropdown-open', false); - } - - } -}); diff --git a/webroot/rsrc/js/core/DropdownMenuItem.js b/webroot/rsrc/js/core/DropdownMenuItem.js deleted file mode 100644 index ab6c4f5872..0000000000 --- a/webroot/rsrc/js/core/DropdownMenuItem.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @requires javelin-install - * javelin-dom - * @provides phabricator-menu-item - * @javelin - */ - -JX.install('PhabricatorMenuItem', { - - construct : function(name, action, href) { - this.setName(name); - this.setHref(href || '#'); - this._action = action; - }, - - members : { - _action : null, - - render : function() { - var classes = []; - classes.push('dropdown-menu-item'); - - if (this.getSelected()) { - classes.push('dropdown-menu-item-selected'); - } - - if (this.getDisabled()) { - classes.push('dropdown-menu-item-disabled'); - } - - var attrs = { - href: this.getHref(), - meta: { item: this }, - className: classes.join(' ') - }; - - if (this.getDisabled()) { - return JX.$N('span', attrs, this.getName()); - } else { - return JX.$N('a', attrs, this.getName()); - } - }, - - select : function() { - this._action(); - } - }, - - properties : { - name: '', - href: '', - disabled: false, - selected: false - } - -});