1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Diffusion browser: Update editor link when clicking on a line

Summary: Highlighing and URL are fixed on click - now the edit button too.

Test Plan: click on lines with and without value in "Editr Link" (And without %l in it).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9227
This commit is contained in:
Aviv Eyal 2014-05-22 15:33:21 -07:00 committed by epriestley
parent 27a369d15a
commit 9bba4cda2f
3 changed files with 17 additions and 9 deletions

View file

@ -460,7 +460,7 @@ return array(
'rsrc/js/core/behavior-keyboard-shortcuts.js' => 'd75709e6',
'rsrc/js/core/behavior-konami.js' => '5bc2cb21',
'rsrc/js/core/behavior-lightbox-attachments.js' => '3aa45ad9',
'rsrc/js/core/behavior-line-linker.js' => 'bc778103',
'rsrc/js/core/behavior-line-linker.js' => '0969ff43',
'rsrc/js/core/behavior-more.js' => '9b9197be',
'rsrc/js/core/behavior-object-selector.js' => 'e6f67523',
'rsrc/js/core/behavior-oncopy.js' => 'c3e218fe',
@ -601,7 +601,7 @@ return array(
'javelin-behavior-phabricator-hovercards' => '9c808199',
'javelin-behavior-phabricator-keyboard-pager' => 'b657bdf8',
'javelin-behavior-phabricator-keyboard-shortcuts' => 'd75709e6',
'javelin-behavior-phabricator-line-linker' => 'bc778103',
'javelin-behavior-phabricator-line-linker' => '0969ff43',
'javelin-behavior-phabricator-nav' => 'b5842a5e',
'javelin-behavior-phabricator-notification-example' => 'c51a6616',
'javelin-behavior-phabricator-object-selector' => 'e6f67523',
@ -864,6 +864,13 @@ return array(
array(
0 => 'javelin-install',
),
'0969ff43' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-stratcom',
2 => 'javelin-dom',
3 => 'javelin-history',
),
'09b15cf1' =>
array(
0 => 'javelin-stratcom',
@ -1683,13 +1690,6 @@ return array(
0 => 'javelin-install',
1 => 'javelin-dom',
),
'bc778103' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-stratcom',
2 => 'javelin-dom',
3 => 'javelin-history',
),
'bd0aedcd' =>
array(
0 => 'javelin-install',

View file

@ -413,6 +413,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
$callsign = $repository->getCallsign();
$editor_link = $user->loadEditorLink($path, $line, $callsign);
$template = $user->loadEditorLink($path, '%l', $callsign);
$icon_edit = id(new PHUIIconView())
->setIconFont('fa-pencil');
@ -421,6 +422,8 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
->setText(pht('Open in Editor'))
->setHref($editor_link)
->setIcon($icon_edit)
->setID('editor_link')
->setMetadata(array('link_template' => $template))
->setDisabled(!$editor_link);
return $button;

View file

@ -10,6 +10,7 @@ JX.behavior('phabricator-line-linker', function() {
var origin = null;
var target = null;
var root = null;
var editor_link = JX.$('editor_link');
function getRowNumber(tr) {
var th = JX.DOM.find(tr, 'th', 'phabricator-source-line');
@ -79,6 +80,10 @@ JX.behavior('phabricator-line-linker', function() {
target = null;
e.kill();
JX.History.replace(uri);
if (editor_link.href) {
editdata = JX.Stratcom.getData(editor_link);
editor_link.href = editdata.link_template.replace('%25l', o);
}
});
});