phorge/webroot/rsrc/js/core/DropdownMenuItem.js
epriestley 130a15b51b Highlight the currently selected policy in the policy dropdown control thing
Summary: Ref T603. Make this a little easier to use by highlighting the current value.

Test Plan: See screenshot.

Reviewers: chad, btrahan

Reviewed By: chad

CC: chad, aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7289
2013-10-12 17:08:35 -07:00

46 lines
832 B
JavaScript

/**
* @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 attrs = {
href: this.getHref(),
meta: { item: this },
className: this.getSelected() ? 'phabricator-menu-item-selected' : null
};
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
}
});