mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
change DifferentialRevisionDetailView to use newer fangled UI abstractions
Summary: actions are still a bit messy - unsatisfactory icons (T2013 will help!) Test Plan: viewed diffs - they look good Reviewers: epriestley, vrana Reviewed By: epriestley CC: chad, aran, Korvin Maniphest Tasks: T2007 Differential Revision: https://secure.phabricator.com/D3904
This commit is contained in:
parent
571ec81dd9
commit
bfc5bb7c78
11 changed files with 203 additions and 195 deletions
|
@ -643,7 +643,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'aphront-headsup-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/cf759e39/rsrc/css/aphront/headsup.css',
|
||||
'uri' => '/res/73874cd2/rsrc/css/aphront/headsup.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2760,7 +2760,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-property-list-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/39b4bf73/rsrc/css/layout/phabricator-property-list-view.css',
|
||||
'uri' => '/res/90ed3b02/rsrc/css/layout/phabricator-property-list-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2826,7 +2826,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-standard-page-view' =>
|
||||
array(
|
||||
'uri' => '/res/92068207/rsrc/css/application/base/standard-page-view.css',
|
||||
'uri' => '/res/928211fe/rsrc/css/application/base/standard-page-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -3208,7 +3208,7 @@ celerity_register_resource_map(array(
|
|||
), array(
|
||||
'packages' =>
|
||||
array(
|
||||
'188c56c1' =>
|
||||
'c40ccdf9' =>
|
||||
array(
|
||||
'name' => 'core.pkg.css',
|
||||
'symbols' =>
|
||||
|
@ -3252,7 +3252,7 @@ celerity_register_resource_map(array(
|
|||
36 => 'phabricator-crumbs-view-css',
|
||||
37 => 'phabricator-object-item-list-view-css',
|
||||
),
|
||||
'uri' => '/res/pkg/188c56c1/core.pkg.css',
|
||||
'uri' => '/res/pkg/c40ccdf9/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'8243143a' =>
|
||||
|
@ -3440,20 +3440,20 @@ celerity_register_resource_map(array(
|
|||
'reverse' =>
|
||||
array(
|
||||
'aphront-attached-file-view-css' => '7839ae2d',
|
||||
'aphront-crumbs-view-css' => '188c56c1',
|
||||
'aphront-dialog-view-css' => '188c56c1',
|
||||
'aphront-error-view-css' => '188c56c1',
|
||||
'aphront-form-view-css' => '188c56c1',
|
||||
'aphront-crumbs-view-css' => 'c40ccdf9',
|
||||
'aphront-dialog-view-css' => 'c40ccdf9',
|
||||
'aphront-error-view-css' => 'c40ccdf9',
|
||||
'aphront-form-view-css' => 'c40ccdf9',
|
||||
'aphront-headsup-action-list-view-css' => '99f819b9',
|
||||
'aphront-headsup-view-css' => '188c56c1',
|
||||
'aphront-list-filter-view-css' => '188c56c1',
|
||||
'aphront-pager-view-css' => '188c56c1',
|
||||
'aphront-panel-view-css' => '188c56c1',
|
||||
'aphront-side-nav-view-css' => '188c56c1',
|
||||
'aphront-table-view-css' => '188c56c1',
|
||||
'aphront-tokenizer-control-css' => '188c56c1',
|
||||
'aphront-tooltip-css' => '188c56c1',
|
||||
'aphront-typeahead-control-css' => '188c56c1',
|
||||
'aphront-headsup-view-css' => 'c40ccdf9',
|
||||
'aphront-list-filter-view-css' => 'c40ccdf9',
|
||||
'aphront-pager-view-css' => 'c40ccdf9',
|
||||
'aphront-panel-view-css' => 'c40ccdf9',
|
||||
'aphront-side-nav-view-css' => 'c40ccdf9',
|
||||
'aphront-table-view-css' => 'c40ccdf9',
|
||||
'aphront-tokenizer-control-css' => 'c40ccdf9',
|
||||
'aphront-tooltip-css' => 'c40ccdf9',
|
||||
'aphront-typeahead-control-css' => 'c40ccdf9',
|
||||
'differential-changeset-view-css' => '99f819b9',
|
||||
'differential-core-view-css' => '99f819b9',
|
||||
'differential-inline-comment-editor' => '7ecd31fa',
|
||||
|
@ -3534,48 +3534,48 @@ celerity_register_resource_map(array(
|
|||
'javelin-util' => 'db6d724d',
|
||||
'javelin-vector' => 'db6d724d',
|
||||
'javelin-workflow' => 'db6d724d',
|
||||
'lightbox-attachment-css' => '188c56c1',
|
||||
'lightbox-attachment-css' => 'c40ccdf9',
|
||||
'maniphest-task-summary-css' => '7839ae2d',
|
||||
'maniphest-transaction-detail-css' => '7839ae2d',
|
||||
'phabricator-app-buttons-css' => '188c56c1',
|
||||
'phabricator-app-buttons-css' => 'c40ccdf9',
|
||||
'phabricator-busy' => '8243143a',
|
||||
'phabricator-content-source-view-css' => '99f819b9',
|
||||
'phabricator-core-buttons-css' => '188c56c1',
|
||||
'phabricator-core-css' => '188c56c1',
|
||||
'phabricator-crumbs-view-css' => '188c56c1',
|
||||
'phabricator-directory-css' => '188c56c1',
|
||||
'phabricator-core-buttons-css' => 'c40ccdf9',
|
||||
'phabricator-core-css' => 'c40ccdf9',
|
||||
'phabricator-crumbs-view-css' => 'c40ccdf9',
|
||||
'phabricator-directory-css' => 'c40ccdf9',
|
||||
'phabricator-drag-and-drop-file-upload' => '7ecd31fa',
|
||||
'phabricator-dropdown-menu' => '8243143a',
|
||||
'phabricator-file-upload' => '8243143a',
|
||||
'phabricator-filetree-view-css' => '188c56c1',
|
||||
'phabricator-flag-css' => '188c56c1',
|
||||
'phabricator-form-view-css' => '188c56c1',
|
||||
'phabricator-header-view-css' => '188c56c1',
|
||||
'phabricator-jump-nav' => '188c56c1',
|
||||
'phabricator-filetree-view-css' => 'c40ccdf9',
|
||||
'phabricator-flag-css' => 'c40ccdf9',
|
||||
'phabricator-form-view-css' => 'c40ccdf9',
|
||||
'phabricator-header-view-css' => 'c40ccdf9',
|
||||
'phabricator-jump-nav' => 'c40ccdf9',
|
||||
'phabricator-keyboard-shortcut' => '8243143a',
|
||||
'phabricator-keyboard-shortcut-manager' => '8243143a',
|
||||
'phabricator-main-menu-view' => '188c56c1',
|
||||
'phabricator-main-menu-view' => 'c40ccdf9',
|
||||
'phabricator-menu-item' => '8243143a',
|
||||
'phabricator-nav-view-css' => '188c56c1',
|
||||
'phabricator-nav-view-css' => 'c40ccdf9',
|
||||
'phabricator-notification' => '8243143a',
|
||||
'phabricator-notification-css' => '188c56c1',
|
||||
'phabricator-notification-menu-css' => '188c56c1',
|
||||
'phabricator-object-item-list-view-css' => '188c56c1',
|
||||
'phabricator-notification-css' => 'c40ccdf9',
|
||||
'phabricator-notification-menu-css' => 'c40ccdf9',
|
||||
'phabricator-object-item-list-view-css' => 'c40ccdf9',
|
||||
'phabricator-object-selector-css' => '99f819b9',
|
||||
'phabricator-paste-file-upload' => '8243143a',
|
||||
'phabricator-prefab' => '8243143a',
|
||||
'phabricator-project-tag-css' => '7839ae2d',
|
||||
'phabricator-remarkup-css' => '188c56c1',
|
||||
'phabricator-remarkup-css' => 'c40ccdf9',
|
||||
'phabricator-shaped-request' => '7ecd31fa',
|
||||
'phabricator-side-menu-view-css' => '188c56c1',
|
||||
'phabricator-standard-page-view' => '188c56c1',
|
||||
'phabricator-side-menu-view-css' => 'c40ccdf9',
|
||||
'phabricator-standard-page-view' => 'c40ccdf9',
|
||||
'phabricator-textareautils' => '8243143a',
|
||||
'phabricator-tooltip' => '8243143a',
|
||||
'phabricator-transaction-view-css' => '188c56c1',
|
||||
'sprite-apps-large-css' => '188c56c1',
|
||||
'sprite-gradient-css' => '188c56c1',
|
||||
'sprite-icon-css' => '188c56c1',
|
||||
'sprite-menu-css' => '188c56c1',
|
||||
'syntax-highlighting-css' => '188c56c1',
|
||||
'phabricator-transaction-view-css' => 'c40ccdf9',
|
||||
'sprite-apps-large-css' => 'c40ccdf9',
|
||||
'sprite-gradient-css' => 'c40ccdf9',
|
||||
'sprite-icon-css' => 'c40ccdf9',
|
||||
'sprite-menu-css' => 'c40ccdf9',
|
||||
'syntax-highlighting-css' => 'c40ccdf9',
|
||||
),
|
||||
));
|
||||
|
|
|
@ -303,6 +303,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialRevisionQuery' => 'applications/differential/query/DifferentialRevisionQuery.php',
|
||||
'DifferentialRevisionStatsController' => 'applications/differential/controller/DifferentialRevisionStatsController.php',
|
||||
'DifferentialRevisionStatsView' => 'applications/differential/view/DifferentialRevisionStatsView.php',
|
||||
'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php',
|
||||
'DifferentialRevisionStatusFieldSpecification' => 'applications/differential/field/specification/DifferentialRevisionStatusFieldSpecification.php',
|
||||
'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/DifferentialRevisionUpdateHistoryView.php',
|
||||
'DifferentialRevisionViewController' => 'applications/differential/controller/DifferentialRevisionViewController.php',
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* NOTE: you probably want {@class:ArcanistDifferentialRevisionStatus}.
|
||||
* This class just contains a mapping for color within the Differential
|
||||
* application.
|
||||
*/
|
||||
|
||||
final class DifferentialRevisionStatus {
|
||||
|
||||
public static function getRevisionStatusTagColor($status) {
|
||||
$default = PhabricatorTagView::COLOR_GREY;
|
||||
|
||||
$map = array(
|
||||
ArcanistDifferentialRevisionStatus::NEEDS_REVIEW =>
|
||||
PhabricatorTagView::COLOR_ORANGE,
|
||||
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
||||
PhabricatorTagView::COLOR_RED,
|
||||
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
||||
PhabricatorTagView::COLOR_GREEN,
|
||||
ArcanistDifferentialRevisionStatus::CLOSED =>
|
||||
PhabricatorTagView::COLOR_BLUE,
|
||||
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
||||
PhabricatorTagView::COLOR_BLACK,
|
||||
);
|
||||
return idx($map, $status, $default);
|
||||
}
|
||||
}
|
|
@ -226,6 +226,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
$revision_detail = new DifferentialRevisionDetailView();
|
||||
$revision_detail->setRevision($revision);
|
||||
$revision_detail->setDiff(reset($diffs));
|
||||
$revision_detail->setAuxiliaryFields($aux_fields);
|
||||
|
||||
$actions = $this->getRevisionActions($revision);
|
||||
|
@ -474,7 +475,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
if ($viewer_is_owner) {
|
||||
$links[] = array(
|
||||
'class' => 'revision-edit',
|
||||
'icon' => 'edit',
|
||||
'href' => "/differential/revision/edit/{$revision_id}/",
|
||||
'name' => 'Edit Revision',
|
||||
);
|
||||
|
@ -482,39 +483,19 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
if (!$viewer_is_anonymous) {
|
||||
|
||||
require_celerity_resource('phabricator-flag-css');
|
||||
|
||||
$flag = PhabricatorFlagQuery::loadUserFlag($user, $revision_phid);
|
||||
if ($flag) {
|
||||
$class = PhabricatorFlagColor::getCSSClass($flag->getColor());
|
||||
$color = PhabricatorFlagColor::getColorName($flag->getColor());
|
||||
$links[] = array(
|
||||
'class' => 'flag-clear '.$class,
|
||||
'href' => '/flag/delete/'.$flag->getID().'/',
|
||||
'name' => phutil_escape_html('Remove '.$color.' Flag'),
|
||||
'sigil' => 'workflow',
|
||||
);
|
||||
} else {
|
||||
$links[] = array(
|
||||
'class' => 'flag-add phabricator-flag-ghost',
|
||||
'href' => '/flag/edit/'.$revision_phid.'/',
|
||||
'name' => 'Flag Revision',
|
||||
'sigil' => 'workflow',
|
||||
);
|
||||
}
|
||||
|
||||
if (!$viewer_is_owner && !$viewer_is_reviewer) {
|
||||
$action = $viewer_is_cc ? 'rem' : 'add';
|
||||
$links[] = array(
|
||||
'class' => $viewer_is_cc ? 'subscribe-rem' : 'subscribe-add',
|
||||
'icon' => $viewer_is_cc ? 'subscribe-delete' : 'subscribe-add',
|
||||
'href' => "/differential/subscribe/{$action}/{$revision_id}/",
|
||||
'name' => $viewer_is_cc ? 'Unsubscribe' : 'Subscribe',
|
||||
'instant' => true,
|
||||
);
|
||||
} else {
|
||||
$links[] = array(
|
||||
'class' => 'subscribe-rem unavailable',
|
||||
'name' => 'Automatically Subscribed',
|
||||
'icon' => 'subscribe-auto',
|
||||
'name' => 'Automatically Subscribed',
|
||||
'disabled' => true,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -522,7 +503,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
require_celerity_resource('javelin-behavior-phabricator-object-selector');
|
||||
|
||||
$links[] = array(
|
||||
'class' => 'action-dependencies',
|
||||
'icon' => 'link',
|
||||
'name' => 'Edit Dependencies',
|
||||
'href' => "/search/attach/{$revision_phid}/DREV/dependencies/",
|
||||
'sigil' => 'workflow',
|
||||
|
@ -530,7 +511,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
|
||||
$links[] = array(
|
||||
'class' => 'attach-maniphest',
|
||||
'icon' => 'attach',
|
||||
'name' => 'Edit Maniphest Tasks',
|
||||
'href' => "/search/attach/{$revision_phid}/TASK/",
|
||||
'sigil' => 'workflow',
|
||||
|
@ -539,14 +520,14 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
if ($user->getIsAdmin()) {
|
||||
$links[] = array(
|
||||
'class' => 'transcripts-metamta',
|
||||
'icon' => 'file',
|
||||
'name' => 'MetaMTA Transcripts',
|
||||
'href' => "/mail/?phid={$revision_phid}",
|
||||
);
|
||||
}
|
||||
|
||||
$links[] = array(
|
||||
'class' => 'transcripts-herald',
|
||||
'icon' => 'file',
|
||||
'name' => 'Herald Transcripts',
|
||||
'href' => "/herald/transcript/?phid={$revision_phid}",
|
||||
);
|
||||
|
@ -554,7 +535,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
$request_uri = $this->getRequest()->getRequestURI();
|
||||
$links[] = array(
|
||||
'class' => 'action-download',
|
||||
'icon' => 'download',
|
||||
'name' => 'Download Raw Diff',
|
||||
'href' => $request_uri->alter('download', 'true')
|
||||
);
|
||||
|
|
|
@ -4,62 +4,7 @@ final class DifferentialRevisionStatusFieldSpecification
|
|||
extends DifferentialFieldSpecification {
|
||||
|
||||
public function shouldAppearOnRevisionView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function renderLabelForRevisionView() {
|
||||
return 'Revision Status:';
|
||||
}
|
||||
|
||||
public function renderValueForRevisionView() {
|
||||
$revision = $this->getRevision();
|
||||
$diff = $this->getDiff();
|
||||
|
||||
$status = $revision->getStatus();
|
||||
$info = null;
|
||||
$local_vcs = $diff->getSourceControlSystem();
|
||||
$backing_vcs = $diff->getBackingVersionControlSystem();
|
||||
if (!$backing_vcs) {
|
||||
$backing_vcs = $local_vcs;
|
||||
}
|
||||
|
||||
if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
||||
$next_step = null;
|
||||
switch ($local_vcs) {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||
$next_step = '<tt>arc land</tt>';
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
$next_step = '<tt>arc commit</tt>';
|
||||
break;
|
||||
}
|
||||
if ($next_step) {
|
||||
$info = ' · Next step: '.$next_step;
|
||||
}
|
||||
} else if ($status == ArcanistDifferentialRevisionStatus::CLOSED) {
|
||||
$committed = $revision->getDateCommitted();
|
||||
if ($committed) {
|
||||
$verb = null;
|
||||
switch ($backing_vcs) {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||
$verb = 'Pushed';
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
$verb = 'Committed';
|
||||
break;
|
||||
}
|
||||
if ($verb) {
|
||||
$when = phabricator_datetime($committed, $this->getUser());
|
||||
$info = " ({$verb} {$when})";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$status =
|
||||
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
|
||||
return '<strong>'.$status.'</strong>'.$info;
|
||||
return false;
|
||||
}
|
||||
|
||||
public function shouldAppearOnRevisionList() {
|
||||
|
|
|
@ -6,8 +6,17 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
|||
private $actions;
|
||||
private $user;
|
||||
private $auxiliaryFields = array();
|
||||
private $diff;
|
||||
|
||||
public function setRevision($revision) {
|
||||
public function setDiff(DifferentialDiff $diff) {
|
||||
$this->diff = $diff;
|
||||
return $this;
|
||||
}
|
||||
private function getDiff() {
|
||||
return $this->diff;
|
||||
}
|
||||
|
||||
public function setRevision(DifferentialRevision $revision) {
|
||||
$this->revision = $revision;
|
||||
return $this;
|
||||
}
|
||||
|
@ -16,11 +25,17 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
|||
$this->actions = $actions;
|
||||
return $this;
|
||||
}
|
||||
private function getActions() {
|
||||
return $this->actions;
|
||||
}
|
||||
|
||||
public function setUser($user) {
|
||||
public function setUser(PhabricatorUser $user) {
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
private function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setAuxiliaryFields(array $fields) {
|
||||
assert_instances_of($fields, 'DifferentialFieldSpecification');
|
||||
|
@ -33,39 +48,74 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
|||
require_celerity_resource('differential-core-view-css');
|
||||
|
||||
$revision = $this->revision;
|
||||
$user = $this->getUser();
|
||||
|
||||
$header = $this->renderHeader($revision);
|
||||
|
||||
$actions = id(new PhabricatorActionListView())
|
||||
->setUser($user)
|
||||
->setObject($revision);
|
||||
foreach ($this->getActions() as $action) {
|
||||
$obj = id(new PhabricatorActionView())
|
||||
->setIcon(idx($action, 'icon', 'edit'))
|
||||
->setName($action['name'])
|
||||
->setHref(idx($action, 'href'))
|
||||
->setWorkflow(idx($action, 'sigil') == 'workflow')
|
||||
->setUser($user)
|
||||
->setDisabled(idx($action, 'disabled', false));
|
||||
$actions->addAction($obj);
|
||||
}
|
||||
|
||||
$properties = new PhabricatorPropertyListView();
|
||||
$status = $revision->getStatus();
|
||||
$local_vcs = $this->getDiff()->getSourceControlSystem();
|
||||
|
||||
$next_step = null;
|
||||
if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
||||
switch ($local_vcs) {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||
$next_step = '<tt>arc land</tt>';
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
$next_step = '<tt>arc commit</tt>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($next_step) {
|
||||
$properties->addProperty('Next Step:', $next_step);
|
||||
}
|
||||
|
||||
$dict = array();
|
||||
foreach ($this->auxiliaryFields as $field) {
|
||||
$value = $field->renderValueForRevisionView();
|
||||
if (strlen($value)) {
|
||||
$label = rtrim($field->renderLabelForRevisionView(), ':');
|
||||
$dict[$label] = $value;
|
||||
$properties->addProperty($label, $value);
|
||||
}
|
||||
}
|
||||
$properties->setHasKeyboardShortcuts(true);
|
||||
|
||||
$actions = array();
|
||||
foreach ($this->actions as $action) {
|
||||
$obj = new AphrontHeadsupActionView();
|
||||
$obj->setName($action['name']);
|
||||
$obj->setURI(idx($action, 'href'));
|
||||
$obj->setWorkflow(idx($action, 'sigil') == 'workflow');
|
||||
$obj->setClass(idx($action, 'class'));
|
||||
$obj->setInstant(idx($action, 'instant'));
|
||||
$obj->setUser($this->user);
|
||||
$actions[] = $obj;
|
||||
}
|
||||
return $header->render() . $actions->render() . $properties->render();
|
||||
}
|
||||
|
||||
$action_list = new AphrontHeadsupActionListView();
|
||||
$action_list->setActions($actions);
|
||||
private function renderHeader(DifferentialRevision $revision) {
|
||||
$view = id(new PhabricatorHeaderView())
|
||||
->setObjectName('D'.$revision->getID())
|
||||
->setHeader($revision->getTitle());
|
||||
|
||||
$action_panel = new AphrontHeadsupView();
|
||||
$action_panel->setActionList($action_list);
|
||||
$action_panel->setHasKeyboardShortcuts(true);
|
||||
$action_panel->setProperties($dict);
|
||||
$status = $revision->getStatus();
|
||||
$status_name =
|
||||
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
|
||||
$status_color =
|
||||
DifferentialRevisionStatus::getRevisionStatusTagColor($status);
|
||||
|
||||
$action_panel->setObjectName('D'.$revision->getID());
|
||||
$action_panel->setHeader($revision->getTitle());
|
||||
$view->addTag(
|
||||
id(new PhabricatorTagView())
|
||||
->setType(PhabricatorTagView::TYPE_STATE)
|
||||
->setName($status_name)
|
||||
->setBackgroundColor($status_color)
|
||||
);
|
||||
|
||||
return $action_panel->render();
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,17 @@
|
|||
final class PhabricatorPropertyListView extends AphrontView {
|
||||
|
||||
private $parts = array();
|
||||
private $hasKeyboardShortcuts;
|
||||
|
||||
protected function canAppendChild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setHasKeyboardShortcuts($has_keyboard_shortcuts) {
|
||||
$this->hasKeyboardShortcuts = $has_keyboard_shortcuts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addProperty($key, $value) {
|
||||
$current = array_pop($this->parts);
|
||||
|
||||
|
@ -102,13 +108,32 @@ final class PhabricatorPropertyListView extends AphrontView {
|
|||
),
|
||||
$this->renderSingleView($items));
|
||||
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-property-list-container',
|
||||
),
|
||||
$list.
|
||||
'<div class="phabriator-property-list-view-end"></div>');
|
||||
$content = $this->renderChildren();
|
||||
if (strlen($content)) {
|
||||
$content = phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-property-list-content',
|
||||
),
|
||||
$content);
|
||||
}
|
||||
|
||||
$shortcuts = null;
|
||||
if ($this->hasKeyboardShortcuts) {
|
||||
$shortcuts =
|
||||
id(new AphrontKeyboardShortcutsAvailableView())->render();
|
||||
}
|
||||
|
||||
return
|
||||
$shortcuts.
|
||||
phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-property-list-container',
|
||||
),
|
||||
$list.
|
||||
'<div class="phabriator-property-list-view-end"></div>'
|
||||
);
|
||||
}
|
||||
|
||||
private function renderSectionPart(array $part) {
|
||||
|
|
|
@ -6,7 +6,6 @@ final class AphrontHeadsupView extends AphrontView {
|
|||
private $header;
|
||||
private $properties;
|
||||
private $objectName;
|
||||
private $hasKeyboardShortcuts;
|
||||
|
||||
public function setActionList(AphrontHeadsupActionListView $action_list) {
|
||||
$this->actionList = $action_list;
|
||||
|
@ -28,15 +27,6 @@ final class AphrontHeadsupView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setHasKeyboardShortcuts($has_keyboard_shortcuts) {
|
||||
$this->hasKeyboardShortcuts = $has_keyboard_shortcuts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHasKeyboardShortcuts() {
|
||||
return $this->hasKeyboardShortcuts;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$header =
|
||||
'<h1>'.
|
||||
|
@ -53,14 +43,6 @@ final class AphrontHeadsupView extends AphrontView {
|
|||
|
||||
require_celerity_resource('aphront-headsup-view-css');
|
||||
|
||||
$shortcuts = null;
|
||||
if ($this->hasKeyboardShortcuts) {
|
||||
$shortcuts =
|
||||
'<div class="aphront-headsup-keyboard-shortcuts">'.
|
||||
id(new AphrontKeyboardShortcutsAvailableView())->render().
|
||||
'</div>';
|
||||
}
|
||||
|
||||
$prop_table = null;
|
||||
if ($this->properties) {
|
||||
$prop_table = array();
|
||||
|
@ -88,7 +70,6 @@ final class AphrontHeadsupView extends AphrontView {
|
|||
return
|
||||
'<div class="aphront-headsup-panel">'.
|
||||
self::renderSingleView($this->actionList).
|
||||
$shortcuts.
|
||||
'<div class="aphront-headsup-core">'.
|
||||
$header.
|
||||
$prop_table.
|
||||
|
|
|
@ -47,8 +47,3 @@
|
|||
.aphront-headsup-object-name {
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
.aphront-headsup-keyboard-shortcuts {
|
||||
float: right;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
|
|
@ -52,17 +52,6 @@
|
|||
border: 1px solid #999900;
|
||||
}
|
||||
|
||||
.keyboard-shortcuts-available {
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
color: #666666;
|
||||
text-align: right;
|
||||
padding-right: 24px;
|
||||
font-size: 11px;
|
||||
background:
|
||||
url('/rsrc/image/icon/fatcow/key_question.png') right center no-repeat;
|
||||
}
|
||||
|
||||
.workflow-header {
|
||||
background: #efefef;
|
||||
padding: 6px 2em;
|
||||
|
|
|
@ -11,6 +11,19 @@
|
|||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.phabricator-property-list-view .keyboard-shortcuts-available {
|
||||
float: right;
|
||||
height: 16px;
|
||||
margin: 12px 10px -28px 0px;
|
||||
padding: 0px 20px 0px 0px;
|
||||
vertical-align: middle;
|
||||
color: #666666;
|
||||
text-align: right;
|
||||
font-size: 11px;
|
||||
background:
|
||||
url('/rsrc/image/icon/fatcow/key_question.png') right center no-repeat;
|
||||
}
|
||||
|
||||
.phabricator-property-list-container {
|
||||
border-color: #c0c5d1;
|
||||
border-style: solid;
|
||||
|
|
Loading…
Reference in a new issue