mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Display Show Raw File links in Differential only if the file exists
Test Plan: Open menu for added file Open menu for deleted file Open menu for changed file Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1410
This commit is contained in:
parent
025cc1376e
commit
c7997e0a7c
4 changed files with 47 additions and 34 deletions
|
@ -330,17 +330,6 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/js/javelin/lib/behavior.js',
|
||||
),
|
||||
0 =>
|
||||
array(
|
||||
'uri' => '/res/b6096fdd/rsrc/js/javelin/lib/__tests__/URI.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-uri',
|
||||
1 => 'javelin-php-serializer',
|
||||
),
|
||||
'disk' => '/rsrc/js/javelin/lib/__tests__/URI.js',
|
||||
),
|
||||
'javelin-behavior-aphront-basic-tokenizer' =>
|
||||
array(
|
||||
'uri' => '/res/9be30797/rsrc/js/application/core/behavior-tokenizer.js',
|
||||
|
@ -472,7 +461,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-differential-dropdown-menus' =>
|
||||
array(
|
||||
'uri' => '/res/5a56f221/rsrc/js/application/differential/behavior-dropdown-menus.js',
|
||||
'uri' => '/res/4d4bea31/rsrc/js/application/differential/behavior-dropdown-menus.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1438,18 +1427,6 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/application/objectselector/object-selector.css',
|
||||
),
|
||||
'phabricator-prefab' =>
|
||||
array(
|
||||
'uri' => '/res/5784a112/rsrc/js/application/core/Prefab.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-install',
|
||||
1 => 'javelin-util',
|
||||
2 => 'javelin-dom',
|
||||
),
|
||||
'disk' => '/rsrc/js/application/core/Prefab.js',
|
||||
),
|
||||
'phabricator-profile-css' =>
|
||||
array(
|
||||
'uri' => '/res/9869d10b/rsrc/css/application/profile/profile-view.css',
|
||||
|
@ -1468,6 +1445,29 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/application/profile/profile-header-view.css',
|
||||
),
|
||||
0 =>
|
||||
array(
|
||||
'uri' => '/res/b6096fdd/rsrc/js/javelin/lib/__tests__/URI.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-uri',
|
||||
1 => 'javelin-php-serializer',
|
||||
),
|
||||
'disk' => '/rsrc/js/javelin/lib/__tests__/URI.js',
|
||||
),
|
||||
'phabricator-prefab' =>
|
||||
array(
|
||||
'uri' => '/res/5784a112/rsrc/js/application/core/Prefab.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-install',
|
||||
1 => 'javelin-util',
|
||||
2 => 'javelin-dom',
|
||||
),
|
||||
'disk' => '/rsrc/js/application/core/Prefab.js',
|
||||
),
|
||||
'phabricator-remarkup-css' =>
|
||||
array(
|
||||
'uri' => '/res/795fa8a9/rsrc/css/core/remarkup.css',
|
||||
|
|
|
@ -118,17 +118,25 @@ class DifferentialChangesetListView extends AphrontView {
|
|||
$changeset->getAbsoluteRepositoryPath($this->diff, $repository));
|
||||
}
|
||||
|
||||
$meta = array(
|
||||
'detailURI' => (string)$detail_uri,
|
||||
'diffusionURI' => $diffusion_uri,
|
||||
'containerID' => $detail->getID(),
|
||||
);
|
||||
$change = $changeset->getChangeType();
|
||||
if ($change != DifferentialChangeType::TYPE_ADD) {
|
||||
$meta['leftURI'] = (string)$detail_uri->alter('view', 'old');
|
||||
}
|
||||
if ($change != DifferentialChangeType::TYPE_DELETE &&
|
||||
$change != DifferentialChangeType::TYPE_MULTICOPY) {
|
||||
$meta['rightURI'] = (string)$detail_uri->alter('view', 'new');
|
||||
}
|
||||
|
||||
$detail_button = javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'button small grey',
|
||||
'meta' => array(
|
||||
'detailURI' => (string)$detail_uri,
|
||||
'leftURI' => (string)$detail_uri->alter('view', 'old'),
|
||||
'rightURI' => (string)$detail_uri->alter('view', 'new'),
|
||||
'diffusionURI' => $diffusion_uri,
|
||||
'containerID' => $detail->getID(),
|
||||
),
|
||||
'meta' => $meta,
|
||||
'href' => $detail_uri,
|
||||
'target' => '_blank',
|
||||
'sigil' => 'differential-view-options',
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/changesetdetailview');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
|
|
|
@ -48,9 +48,13 @@ JX.behavior('differential-dropdown-menus', function(config) {
|
|||
var menu = new JX.PhabricatorDropdownMenu(buttons[ii])
|
||||
.addItem(reveal_item)
|
||||
.addItem(diffusion_item)
|
||||
.addItem(link_to('View Standalone', data.detailURI))
|
||||
.addItem(link_to('Show Raw File (Left)', data.leftURI))
|
||||
.addItem(link_to('Show Raw File (Right)', data.rightURI));
|
||||
.addItem(link_to('View Standalone', data.detailURI));
|
||||
if (data.leftURI) {
|
||||
menu.addItem(link_to('Show Raw File (Left)', data.leftURI));
|
||||
}
|
||||
if (data.rightURI) {
|
||||
menu.addItem(link_to('Show Raw File (Right)', data.rightURI));
|
||||
}
|
||||
|
||||
menu.listen(
|
||||
'open',
|
||||
|
|
Loading…
Reference in a new issue