1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Have Browse button in History actually work

Summary: Ref T12780. Makes the button do something useful, like link to the history at the right spot in the graph.

Test Plan: Click on various browse buttons, get correct url.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12780

Differential Revision: https://secure.phabricator.com/D18054
This commit is contained in:
Chad Little 2017-05-30 20:18:13 -07:00
parent 683647f1fb
commit 6295e37857
2 changed files with 16 additions and 10 deletions

View file

@ -105,13 +105,14 @@ final class DiffusionHistoryListView extends DiffusionHistoryView {
} }
} }
$browse = $this->linkBrowse( $browse_button = $this->linkBrowse(
$history->getPath(), $history->getPath(),
array( array(
'commit' => $history->getCommitIdentifier(), 'commit' => $history->getCommitIdentifier(),
'branch' => $drequest->getBranch(), 'branch' => $drequest->getBranch(),
'type' => $history->getFileType(), 'type' => $history->getFileType(),
)); ),
true);
$differential_view = null; $differential_view = null;
if ($show_revisions && $commit) { if ($show_revisions && $commit) {
@ -192,13 +193,6 @@ final class DiffusionHistoryListView extends DiffusionHistoryView {
->setColor(PHUITagView::COLOR_INDIGO) ->setColor(PHUITagView::COLOR_INDIGO)
->setSlimShady(true); ->setSlimShady(true);
$browse_button = id(new PHUIButtonView())
->setText(pht('Browse'))
->setIcon('fa-code')
->setTag('a')
->setColor(PHUIButtonView::SIMPLE)
->appendChild($audit_view);
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setHeader($commit_desc) ->setHeader($commit_desc)
->setHref($commit_link) ->setHref($commit_link)

View file

@ -58,7 +58,10 @@ abstract class DiffusionView extends AphrontView {
id(new PHUIIconView())->setIcon('fa-history bluegrey')); id(new PHUIIconView())->setIcon('fa-history bluegrey'));
} }
final public function linkBrowse($path, array $details = array()) { final public function linkBrowse(
$path,
array $details = array(),
$button = false) {
require_celerity_resource('diffusion-icons-css'); require_celerity_resource('diffusion-icons-css');
Javelin::initBehavior('phabricator-tooltips'); Javelin::initBehavior('phabricator-tooltips');
@ -111,6 +114,15 @@ abstract class DiffusionView extends AphrontView {
); );
} }
if ($button) {
return id(new PHUIButtonView())
->setText(pht('Browse'))
->setIcon('fa-code')
->setHref($href)
->setTag('a')
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
}
return javelin_tag( return javelin_tag(
'a', 'a',
array( array(