Fill <a href> in PhabricatorMenuItem
Summary: The <a href> attribute is useful because user knows where the link goes before opening it plus he can copy it to the clipboard plus he can add it to the bookmarks. Test Plan: Display revision. View Options. Click. Reviewers: epriestley Reviewed By: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D1436
This commit is contained in:
@@ -472,7 +472,7 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
'javelin-behavior-differential-dropdown-menus' =>
|
||||
array(
|
||||
'uri' => '/res/4d4bea31/rsrc/js/application/differential/behavior-dropdown-menus.js',
|
||||
'uri' => '/res/acba60ad/rsrc/js/application/differential/behavior-dropdown-menus.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
@@ -1419,7 +1419,7 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
'phabricator-menu-item' =>
|
||||
array(
|
||||
'uri' => '/res/08d90375/rsrc/js/application/core/DropdownMenuItem.js',
|
||||
'uri' => '/res/32fc2325/rsrc/js/application/core/DropdownMenuItem.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
|
||||
JX.install('PhabricatorMenuItem', {
|
||||
|
||||
construct : function(name, action) {
|
||||
construct : function(name, action, href) {
|
||||
this.setName(name);
|
||||
this.setHref(href || '#');
|
||||
this._action = action;
|
||||
},
|
||||
|
||||
@@ -19,7 +20,7 @@ JX.install('PhabricatorMenuItem', {
|
||||
if (this.getDisabled()) {
|
||||
return JX.$N('span', this.getName());
|
||||
} else {
|
||||
var attrs = { href : '#', meta : { item : this } };
|
||||
var attrs = { href : this.getHref(), meta : { item : this } };
|
||||
return JX.$N('a', attrs, this.getName());
|
||||
}
|
||||
},
|
||||
@@ -31,6 +32,7 @@ JX.install('PhabricatorMenuItem', {
|
||||
|
||||
properties : {
|
||||
name : '',
|
||||
href : '',
|
||||
disabled : false
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ JX.behavior('differential-dropdown-menus', function(config) {
|
||||
function link_to(name, uri) {
|
||||
var item = new JX.PhabricatorMenuItem(
|
||||
name,
|
||||
JX.bind(null, window.open, uri));
|
||||
JX.bind(null, window.open, uri),
|
||||
uri);
|
||||
item.setDisabled(!uri);
|
||||
return item;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user