1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 16:00:59 +01:00

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:
vrana 2012-01-16 22:17:18 -08:00
parent ef768f9694
commit ae0d9770a5
3 changed files with 8 additions and 5 deletions

View file

@ -472,7 +472,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-differential-dropdown-menus' => 'javelin-behavior-differential-dropdown-menus' =>
array( 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', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -1419,7 +1419,7 @@ celerity_register_resource_map(array(
), ),
'phabricator-menu-item' => 'phabricator-menu-item' =>
array( array(
'uri' => '/res/08d90375/rsrc/js/application/core/DropdownMenuItem.js', 'uri' => '/res/32fc2325/rsrc/js/application/core/DropdownMenuItem.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(

View file

@ -7,8 +7,9 @@
JX.install('PhabricatorMenuItem', { JX.install('PhabricatorMenuItem', {
construct : function(name, action) { construct : function(name, action, href) {
this.setName(name); this.setName(name);
this.setHref(href || '#');
this._action = action; this._action = action;
}, },
@ -19,7 +20,7 @@ JX.install('PhabricatorMenuItem', {
if (this.getDisabled()) { if (this.getDisabled()) {
return JX.$N('span', this.getName()); return JX.$N('span', this.getName());
} else { } else {
var attrs = { href : '#', meta : { item : this } }; var attrs = { href : this.getHref(), meta : { item : this } };
return JX.$N('a', attrs, this.getName()); return JX.$N('a', attrs, this.getName());
} }
}, },
@ -31,6 +32,7 @@ JX.install('PhabricatorMenuItem', {
properties : { properties : {
name : '', name : '',
href : '',
disabled : false disabled : false
} }

View file

@ -33,7 +33,8 @@ JX.behavior('differential-dropdown-menus', function(config) {
function link_to(name, uri) { function link_to(name, uri) {
var item = new JX.PhabricatorMenuItem( var item = new JX.PhabricatorMenuItem(
name, name,
JX.bind(null, window.open, uri)); JX.bind(null, window.open, uri),
uri);
item.setDisabled(!uri); item.setDisabled(!uri);
return item; return item;
} }