mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 15:30:58 +01:00
Unify Maniphest + Differential comment styles
Summary: I want to add comments to commits, and they should obviously share code with the nearly-identical comments in Maniphest and Differential. Unify code/style as much as possible. This program made possible by a generous grant from D1513. Test Plan: - Looked at a bunch of different Differential and Maniphest comments; they appeared to render identically to how they looked before. - Tested some edge cases like anchors and "show details" on description edits in Maniphest. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T904 Differential Revision: https://secure.phabricator.com/D1686
This commit is contained in:
parent
97ea6ea619
commit
282d6e5ffa
11 changed files with 391 additions and 288 deletions
|
@ -213,7 +213,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'differential-revision-comment-css' =>
|
||||
array(
|
||||
'uri' => '/res/85efa17a/rsrc/css/application/differential/revision-comment.css',
|
||||
'uri' => '/res/7a0002f1/rsrc/css/application/differential/revision-comment.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1325,7 +1325,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'maniphest-transaction-detail-css' =>
|
||||
array(
|
||||
'uri' => '/res/4083354f/rsrc/css/application/maniphest/transaction-detail.css',
|
||||
'uri' => '/res/24e5862f/rsrc/css/application/maniphest/transaction-detail.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1466,6 +1466,24 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/js/application/core/DropdownMenu.js',
|
||||
),
|
||||
'phabricator-feed-css' =>
|
||||
array(
|
||||
'uri' => '/res/e4bf27b5/rsrc/css/application/feed/feed.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/feed/feed.css',
|
||||
),
|
||||
'phabricator-jump-nav' =>
|
||||
array(
|
||||
'uri' => '/res/69238d2f/rsrc/css/application/directory/phabricator-jump-nav.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/directory/phabricator-jump-nav.css',
|
||||
),
|
||||
'phabricator-keyboard-shortcut' =>
|
||||
array(
|
||||
'uri' => '/res/beed38cd/rsrc/js/application/core/KeyboardShortcut.js',
|
||||
|
@ -1513,47 +1531,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',
|
||||
),
|
||||
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-feed-css' =>
|
||||
array(
|
||||
'uri' => '/res/e4bf27b5/rsrc/css/application/feed/feed.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/feed/feed.css',
|
||||
),
|
||||
'phabricator-jump-nav' =>
|
||||
array(
|
||||
'uri' => '/res/69238d2f/rsrc/css/application/directory/phabricator-jump-nav.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/directory/phabricator-jump-nav.css',
|
||||
),
|
||||
'phabricator-paste-file-upload' =>
|
||||
array(
|
||||
'uri' => '/res/cdc939bd/rsrc/js/application/core/PasteFileUpload.js',
|
||||
|
@ -1568,6 +1545,18 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/js/application/core/PasteFileUpload.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-profile-css' =>
|
||||
array(
|
||||
'uri' => '/res/9869d10b/rsrc/css/application/profile/profile-view.css',
|
||||
|
@ -1634,6 +1623,15 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/application/base/standard-page-view.css',
|
||||
),
|
||||
'phabricator-transaction-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/97f9e8f2/rsrc/css/aphront/transaction.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/aphront/transaction.css',
|
||||
),
|
||||
'phabricator-ui-example-css' =>
|
||||
array(
|
||||
'uri' => '/res/0cef078b/rsrc/css/application/uiexample/example.css',
|
||||
|
@ -1839,6 +1837,17 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/core/syntax.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',
|
||||
),
|
||||
), array(
|
||||
'packages' =>
|
||||
array(
|
||||
|
@ -1886,27 +1895,6 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/46547a92/core.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'4c3b1b11' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.css',
|
||||
'symbols' =>
|
||||
array(
|
||||
0 => 'differential-core-view-css',
|
||||
1 => 'differential-changeset-view-css',
|
||||
2 => 'differential-revision-detail-css',
|
||||
3 => 'differential-revision-history-css',
|
||||
4 => 'differential-table-of-contents-css',
|
||||
5 => 'differential-revision-comment-css',
|
||||
6 => 'differential-revision-add-comment-css',
|
||||
7 => 'differential-revision-comment-list-css',
|
||||
8 => 'phabricator-object-selector-css',
|
||||
9 => 'aphront-headsup-action-list-view-css',
|
||||
10 => 'phabricator-content-source-view-css',
|
||||
11 => 'differential-local-commits-view-css',
|
||||
),
|
||||
'uri' => '/res/pkg/4c3b1b11/differential.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'4fbae2af' =>
|
||||
array(
|
||||
'name' => 'javelin.pkg.js',
|
||||
|
@ -1950,6 +1938,27 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/6a6def05/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'8152415f' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.css',
|
||||
'symbols' =>
|
||||
array(
|
||||
0 => 'differential-core-view-css',
|
||||
1 => 'differential-changeset-view-css',
|
||||
2 => 'differential-revision-detail-css',
|
||||
3 => 'differential-revision-history-css',
|
||||
4 => 'differential-table-of-contents-css',
|
||||
5 => 'differential-revision-comment-css',
|
||||
6 => 'differential-revision-add-comment-css',
|
||||
7 => 'differential-revision-comment-list-css',
|
||||
8 => 'phabricator-object-selector-css',
|
||||
9 => 'aphront-headsup-action-list-view-css',
|
||||
10 => 'phabricator-content-source-view-css',
|
||||
11 => 'differential-local-commits-view-css',
|
||||
),
|
||||
'uri' => '/res/pkg/8152415f/differential.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'c8aaade8' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.js',
|
||||
|
@ -1980,23 +1989,23 @@ celerity_register_resource_map(array(
|
|||
'aphront-crumbs-view-css' => '6a6def05',
|
||||
'aphront-dialog-view-css' => '6a6def05',
|
||||
'aphront-form-view-css' => '6a6def05',
|
||||
'aphront-headsup-action-list-view-css' => '4c3b1b11',
|
||||
'aphront-headsup-action-list-view-css' => '8152415f',
|
||||
'aphront-list-filter-view-css' => '6a6def05',
|
||||
'aphront-panel-view-css' => '6a6def05',
|
||||
'aphront-side-nav-view-css' => '6a6def05',
|
||||
'aphront-table-view-css' => '6a6def05',
|
||||
'aphront-tokenizer-control-css' => '6a6def05',
|
||||
'aphront-typeahead-control-css' => '6a6def05',
|
||||
'differential-changeset-view-css' => '4c3b1b11',
|
||||
'differential-core-view-css' => '4c3b1b11',
|
||||
'differential-changeset-view-css' => '8152415f',
|
||||
'differential-core-view-css' => '8152415f',
|
||||
'differential-inline-comment-editor' => 'c8aaade8',
|
||||
'differential-local-commits-view-css' => '4c3b1b11',
|
||||
'differential-revision-add-comment-css' => '4c3b1b11',
|
||||
'differential-revision-comment-css' => '4c3b1b11',
|
||||
'differential-revision-comment-list-css' => '4c3b1b11',
|
||||
'differential-revision-detail-css' => '4c3b1b11',
|
||||
'differential-revision-history-css' => '4c3b1b11',
|
||||
'differential-table-of-contents-css' => '4c3b1b11',
|
||||
'differential-local-commits-view-css' => '8152415f',
|
||||
'differential-revision-add-comment-css' => '8152415f',
|
||||
'differential-revision-comment-css' => '8152415f',
|
||||
'differential-revision-comment-list-css' => '8152415f',
|
||||
'differential-revision-detail-css' => '8152415f',
|
||||
'differential-revision-history-css' => '8152415f',
|
||||
'differential-table-of-contents-css' => '8152415f',
|
||||
'diffusion-commit-view-css' => '03ef179e',
|
||||
'javelin-behavior' => '4fbae2af',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => '080edee4',
|
||||
|
@ -2034,14 +2043,14 @@ celerity_register_resource_map(array(
|
|||
'javelin-util' => '4fbae2af',
|
||||
'javelin-vector' => '4fbae2af',
|
||||
'javelin-workflow' => '46547a92',
|
||||
'phabricator-content-source-view-css' => '4c3b1b11',
|
||||
'phabricator-content-source-view-css' => '8152415f',
|
||||
'phabricator-core-buttons-css' => '6a6def05',
|
||||
'phabricator-core-css' => '6a6def05',
|
||||
'phabricator-directory-css' => '6a6def05',
|
||||
'phabricator-drag-and-drop-file-upload' => 'c8aaade8',
|
||||
'phabricator-keyboard-shortcut' => '46547a92',
|
||||
'phabricator-keyboard-shortcut-manager' => '46547a92',
|
||||
'phabricator-object-selector-css' => '4c3b1b11',
|
||||
'phabricator-object-selector-css' => '8152415f',
|
||||
'phabricator-remarkup-css' => '6a6def05',
|
||||
'phabricator-shaped-request' => 'c8aaade8',
|
||||
'phabricator-standard-page-view' => '6a6def05',
|
||||
|
|
|
@ -784,6 +784,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorTimelineEventData' => 'infrastructure/daemon/timeline/storage/eventdata',
|
||||
'PhabricatorTimelineIterator' => 'infrastructure/daemon/timeline/cursor/iterator',
|
||||
'PhabricatorTimer' => 'applications/countdown/storage/timer',
|
||||
'PhabricatorTransactionView' => 'view/layout/transaction',
|
||||
'PhabricatorTransformedFile' => 'applications/files/storage/transformed',
|
||||
'PhabricatorTrivialTestCase' => 'infrastructure/testing/testcase/__tests__',
|
||||
'PhabricatorTypeaheadCommonDatasourceController' => 'applications/typeahead/controller/common',
|
||||
|
@ -1503,6 +1504,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorTimelineEvent' => 'PhabricatorTimelineDAO',
|
||||
'PhabricatorTimelineEventData' => 'PhabricatorTimelineDAO',
|
||||
'PhabricatorTimer' => 'PhabricatorCountdownDAO',
|
||||
'PhabricatorTransactionView' => 'AphrontView',
|
||||
'PhabricatorTransformedFile' => 'PhabricatorFileDAO',
|
||||
'PhabricatorTrivialTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorTypeaheadCommonDatasourceController' => 'PhabricatorTypeaheadDatasourceController',
|
||||
|
|
|
@ -95,40 +95,9 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
|||
|
||||
$action_class = 'differential-comment-action-'.$action;
|
||||
|
||||
if ($this->preview) {
|
||||
$date = 'COMMENT PREVIEW';
|
||||
} else {
|
||||
$date = phabricator_datetime($comment->getDateCreated(), $this->user);
|
||||
}
|
||||
|
||||
$info = array();
|
||||
|
||||
$content_source = new PhabricatorContentSourceView();
|
||||
$content_source->setContentSource($comment->getContentSource());
|
||||
$content_source->setUser($this->user);
|
||||
$info[] = $content_source->render();
|
||||
|
||||
$info[] = $date;
|
||||
|
||||
$comment_anchor = null;
|
||||
$anchor_name = $this->anchorName;
|
||||
if ($anchor_name != '' && !$this->preview) {
|
||||
Javelin::initBehavior('phabricator-watch-anchor');
|
||||
$info[] = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'name' => $anchor_name,
|
||||
'id' => $anchor_name,
|
||||
'href' => '#'.$anchor_name,
|
||||
),
|
||||
'D'.$comment->getRevisionID().'#'.$anchor_name);
|
||||
$comment_anchor = 'anchor-'.$anchor_name;
|
||||
}
|
||||
|
||||
$info = implode(' · ', array_filter($info));
|
||||
|
||||
$content = $comment->getContent();
|
||||
$head_content = null;
|
||||
$hide_comments = true;
|
||||
if (strlen(rtrim($content))) {
|
||||
$hide_comments = false;
|
||||
|
@ -277,12 +246,6 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
|||
$author = $this->handles[$comment->getAuthorPHID()];
|
||||
$author_link = $author->renderLink();
|
||||
|
||||
$background = null;
|
||||
$uri = $author->getImageURI();
|
||||
if ($uri) {
|
||||
$background = "background-image: url('{$uri}');";
|
||||
}
|
||||
|
||||
$metadata = $comment->getMetadata();
|
||||
$added_reviewers = idx(
|
||||
$metadata,
|
||||
|
@ -335,29 +298,38 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
|||
$this->renderHandleList($added_ccs).".";
|
||||
}
|
||||
|
||||
$hide_comments_class = ($hide_comments ? 'hide' : '');
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => "differential-comment",
|
||||
'id' => $comment_anchor,
|
||||
'style' => $background,
|
||||
),
|
||||
'<div class="differential-comment-detail '.$action_class.'">'.
|
||||
'<div class="differential-comment-header">'.
|
||||
'<span class="differential-comment-info">'.$info.'</span>'.
|
||||
'<span class="differential-comment-title">'.
|
||||
implode('<br />', $actions).
|
||||
'</span>'.
|
||||
foreach ($actions as $key => $action) {
|
||||
$actions[$key] = '<div>'.$action.'</div>';
|
||||
}
|
||||
|
||||
$xaction_view = id(new PhabricatorTransactionView())
|
||||
->setUser($this->user)
|
||||
->setImageURI($author->getImageURI())
|
||||
->setContentSource($comment->getContentSource())
|
||||
->addClass($action_class)
|
||||
->setActions($actions);
|
||||
|
||||
if ($this->preview) {
|
||||
$xaction_view->setIsPreview($this->preview);
|
||||
} else {
|
||||
$xaction_view->setEpoch($comment->getDateCreated());
|
||||
if ($this->anchorName) {
|
||||
$anchor_name = $this->anchorName;
|
||||
$anchor_text = 'D'.$comment->getRevisionID().'#'.$anchor_name;
|
||||
|
||||
$xaction_view->setAnchor($anchor_name, $anchor_text);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$hide_comments) {
|
||||
$xaction_view->appendChild(
|
||||
'<div class="differential-comment-core">'.
|
||||
$content.
|
||||
'</div>'.
|
||||
'<div class="differential-comment-content '.$hide_comments_class.'">'.
|
||||
$head_content.
|
||||
'<div class="differential-comment-core">'.
|
||||
$content.
|
||||
'</div>'.
|
||||
$inline_render.
|
||||
'</div>'.
|
||||
'</div>');
|
||||
$inline_render);
|
||||
}
|
||||
|
||||
return $xaction_view->render();
|
||||
}
|
||||
|
||||
private function renderHandleList(array $phids) {
|
||||
|
|
|
@ -9,11 +9,9 @@
|
|||
phutil_require_module('phabricator', 'aphront/writeguard');
|
||||
phutil_require_module('phabricator', 'applications/differential/constants/action');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
||||
phutil_require_module('phabricator', 'applications/metamta/contentsource/view');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
phutil_require_module('phabricator', 'view/utils');
|
||||
phutil_require_module('phabricator', 'view/layout/transaction');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
|
|
@ -173,14 +173,11 @@ class ManiphestTransactionDetailView extends ManiphestView {
|
|||
),
|
||||
$author->renderLink().' '.$desc.'.'.$full_summary);
|
||||
}
|
||||
$descs = implode("\n", $descs);
|
||||
|
||||
if ($this->getRenderSummaryOnly()) {
|
||||
return $descs;
|
||||
return implode("\n", $descs);
|
||||
}
|
||||
|
||||
$more_classes = implode(' ', $more_classes);
|
||||
|
||||
if ($comment_transaction && $comment_transaction->hasComments()) {
|
||||
$comments = $comment_transaction->getCache();
|
||||
if (!strlen($comments)) {
|
||||
|
@ -203,58 +200,33 @@ class ManiphestTransactionDetailView extends ManiphestView {
|
|||
$comment_block = null;
|
||||
}
|
||||
|
||||
if ($this->preview) {
|
||||
$timestamp = 'COMMENT PREVIEW';
|
||||
} else {
|
||||
$timestamp = phabricator_datetime(
|
||||
$transaction->getDateCreated(),
|
||||
$this->user);
|
||||
}
|
||||
|
||||
$info = array();
|
||||
|
||||
$source_transaction = nonempty($comment_transaction, $any_transaction);
|
||||
$content_source = new PhabricatorContentSourceView();
|
||||
$content_source->setContentSource($source_transaction->getContentSource());
|
||||
$content_source->setUser($this->user);
|
||||
$info[] = $content_source->render();
|
||||
|
||||
$info[] = $timestamp;
|
||||
$xaction_view = id(new PhabricatorTransactionView())
|
||||
->setUser($this->user)
|
||||
->setImageURI($author->getImageURI())
|
||||
->setContentSource($source_transaction->getContentSource())
|
||||
->setActions($descs);
|
||||
|
||||
$comment_anchor = null;
|
||||
$num = $this->commentNumber;
|
||||
if ($num && !$this->preview) {
|
||||
Javelin::initBehavior('phabricator-watch-anchor');
|
||||
$anchor_name = 'comment-'.$num;
|
||||
$info[] = javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'name' => $anchor_name,
|
||||
'id' => $anchor_name,
|
||||
'href' => '#'.$anchor_name,
|
||||
),
|
||||
'T'.$any_transaction->getTaskID().'#'.$anchor_name);
|
||||
$comment_anchor = 'anchor-'.$anchor_name;
|
||||
foreach ($more_classes as $class) {
|
||||
$xaction_view->addClass($class);
|
||||
}
|
||||
|
||||
$info = implode(' · ', array_filter($info));
|
||||
if ($this->preview) {
|
||||
$xaction_view->setIsPreview($this->preview);
|
||||
} else {
|
||||
$xaction_view->setEpoch($any_transaction->getDateCreated());
|
||||
if ($this->commentNumber) {
|
||||
$anchor_name = 'comment-'.$this->commentNumber;
|
||||
$anchor_text = 'T'.$any_transaction->getTaskID().'#'.$anchor_name;
|
||||
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => "maniphest-transaction-detail-container",
|
||||
'style' => "background-image: url('".$author->getImageURI()."')",
|
||||
'id' => $comment_anchor,
|
||||
),
|
||||
'<div class="maniphest-transaction-detail-view '.$more_classes.'">'.
|
||||
'<div class="maniphest-transaction-header">'.
|
||||
'<div class="maniphest-transaction-timestamp">'.
|
||||
$info.
|
||||
'</div>'.
|
||||
$descs.
|
||||
'</div>'.
|
||||
$comment_block.
|
||||
'</div>');
|
||||
$xaction_view->setAnchor($anchor_name, $anchor_text);
|
||||
}
|
||||
}
|
||||
|
||||
$xaction_view->appendChild($comment_block);
|
||||
|
||||
return $xaction_view->render();
|
||||
}
|
||||
|
||||
private function renderSupplementalInfoForEmail($transaction) {
|
||||
|
|
|
@ -12,14 +12,13 @@ phutil_require_module('phabricator', 'applications/maniphest/constants/priority'
|
|||
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/base');
|
||||
phutil_require_module('phabricator', 'applications/metamta/contentsource/view');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/diff/engine');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||
phutil_require_module('phabricator', 'view/utils');
|
||||
phutil_require_module('phabricator', 'view/layout/transaction');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
|
170
src/view/layout/transaction/PhabricatorTransactionView.php
Normal file
170
src/view/layout/transaction/PhabricatorTransactionView.php
Normal file
|
@ -0,0 +1,170 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class PhabricatorTransactionView extends AphrontView {
|
||||
|
||||
private $user;
|
||||
private $imageURI;
|
||||
private $actions = array();
|
||||
private $epoch;
|
||||
private $contentSource;
|
||||
private $anchorName;
|
||||
private $anchorText;
|
||||
private $isPreview;
|
||||
private $classes = array();
|
||||
|
||||
public function setUser(PhabricatorUser $user) {
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setImageURI($uri) {
|
||||
$this->imageURI = $uri;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setActions(array $actions) {
|
||||
$this->actions = $actions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEpoch($epoch) {
|
||||
$this->epoch = $epoch;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setContentSource(PhabricatorContentSource $source) {
|
||||
$this->contentSource = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAnchor($anchor_name, $anchor_text) {
|
||||
$this->anchorName = $anchor_name;
|
||||
$this->anchorText = $anchor_text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addClass($class) {
|
||||
$this->classes[] = $class;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setIsPreview($preview) {
|
||||
$this->isPreview = $preview;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
if (!$this->user) {
|
||||
throw new Exception("Call setUser() before render()!");
|
||||
}
|
||||
|
||||
require_celerity_resource('phabricator-transaction-view-css');
|
||||
|
||||
$info = $this->renderTransactionInfo();
|
||||
$actions = $this->renderTransactionActions();
|
||||
$style = $this->renderTransactionStyle();
|
||||
$content = $this->renderTransactionContent();
|
||||
$classes = phutil_escape_html(implode(' ', $this->classes));
|
||||
|
||||
$transaction_id = $this->anchorName ? 'anchor-'.$this->anchorName : null;
|
||||
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-transaction-view',
|
||||
'id' => $transaction_id,
|
||||
'style' => $style,
|
||||
),
|
||||
'<div class="phabricator-transaction-detail '.$classes.'">'.
|
||||
'<div class="phabricator-transaction-header">'.
|
||||
$info.
|
||||
$actions.
|
||||
'</div>'.
|
||||
$content.
|
||||
'</div>');
|
||||
|
||||
}
|
||||
|
||||
private function renderTransactionInfo() {
|
||||
$info = array();
|
||||
|
||||
if ($this->contentSource) {
|
||||
$content_source = new PhabricatorContentSourceView();
|
||||
$content_source->setContentSource($this->contentSource);
|
||||
$content_source->setUser($this->user);
|
||||
$source = $content_source->render();
|
||||
if ($source) {
|
||||
$info[] = $source;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isPreview) {
|
||||
$info[] = 'PREVIEW';
|
||||
} else if ($this->epoch) {
|
||||
$info[] = phabricator_datetime($this->epoch, $this->user);
|
||||
}
|
||||
|
||||
if ($this->anchorName) {
|
||||
Javelin::initBehavior('phabricator-watch-anchor');
|
||||
$info[] = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'name' => $this->anchorName,
|
||||
'id' => $this->anchorName,
|
||||
'href' => '#'.$this->anchorName,
|
||||
),
|
||||
phutil_escape_html($this->anchorText));
|
||||
}
|
||||
|
||||
$info = implode(' · ', $info);
|
||||
|
||||
return
|
||||
'<span class="phabricator-transaction-info">'.
|
||||
$info.
|
||||
'</span>';
|
||||
}
|
||||
|
||||
private function renderTransactionActions() {
|
||||
$actions = implode('', $this->actions);
|
||||
return
|
||||
'<span class="phabricator-transaction-actions">'.
|
||||
$actions.
|
||||
'</span>';
|
||||
}
|
||||
|
||||
private function renderTransactionStyle() {
|
||||
if ($this->imageURI) {
|
||||
return 'background-image: url('.$this->imageURI.');';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private function renderTransactionContent() {
|
||||
$content = $this->renderChildren();
|
||||
if (!$content) {
|
||||
return null;
|
||||
}
|
||||
return
|
||||
'<div class="phabricator-transaction-content">'.
|
||||
$content.
|
||||
'</div>';
|
||||
}
|
||||
|
||||
}
|
18
src/view/layout/transaction/__init__.php
Normal file
18
src/view/layout/transaction/__init__.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/metamta/contentsource/view');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
phutil_require_module('phabricator', 'view/utils');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorTransactionView.php');
|
39
webroot/rsrc/css/aphront/transaction.css
Normal file
39
webroot/rsrc/css/aphront/transaction.css
Normal file
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* @provides phabricator-transaction-view-css
|
||||
*/
|
||||
|
||||
.phabricator-transaction-view {
|
||||
background: 0px 2px no-repeat;
|
||||
margin: 1em 0 1.25em;
|
||||
min-height: 50px;
|
||||
padding: 2px 0px;
|
||||
}
|
||||
|
||||
.phabricator-transaction-detail {
|
||||
border-color: #dddddd;
|
||||
border-width: 1px 10px;
|
||||
border-style: solid;
|
||||
margin-left: 54px;
|
||||
}
|
||||
|
||||
.phabricator-transaction-header {
|
||||
background: #f3f3f3;
|
||||
padding: 4px 1em;
|
||||
}
|
||||
|
||||
.phabricator-transaction-header a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.phabricator-transaction-info {
|
||||
color: #666666;
|
||||
float: right;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.phabricator-transaction-content {
|
||||
background: #fcfcfc;
|
||||
line-height: 1.4em;
|
||||
padding: .3em 1em;
|
||||
overflow: auto;
|
||||
}
|
|
@ -2,13 +2,6 @@
|
|||
* @provides differential-revision-comment-css
|
||||
*/
|
||||
|
||||
.differential-comment {
|
||||
background: 0px 2px no-repeat;
|
||||
margin: 1em 0 1.25em;
|
||||
min-height: 50px;
|
||||
padding: 2px 0px;
|
||||
}
|
||||
|
||||
.differential-comment-list {
|
||||
max-width: 1162px;
|
||||
}
|
||||
|
@ -17,17 +10,6 @@
|
|||
max-width: 1162px;
|
||||
}
|
||||
|
||||
.differential-comment-detail {
|
||||
border-color: #dddddd;
|
||||
border-width: 1px 10px;
|
||||
border-style: solid;
|
||||
margin-left: 54px;
|
||||
}
|
||||
|
||||
.differential-comment-detail .hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Spooky haunted panel which floats on the bottom of the screen. */
|
||||
.differential-haunted-panel .differential-add-comment-panel {
|
||||
position: fixed;
|
||||
|
@ -63,78 +45,52 @@
|
|||
border-color: #ffff00;
|
||||
}
|
||||
|
||||
.differential-comment-header {
|
||||
background: #f3f3f3;
|
||||
padding: 4px 1em;
|
||||
}
|
||||
|
||||
.differential-comment-header a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.differential-comment-info {
|
||||
color: #666666;
|
||||
float: right;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.differential-comment-content {
|
||||
background: #fcfcfc;
|
||||
clear: both;
|
||||
line-height: 1.4em;
|
||||
margin: 0em;
|
||||
padding: .3em 5px .4em 1.25em;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.differential-inline-comment-content {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.differential-comment-content .phabricator-remarkup .remarkup-code-block,
|
||||
.differential-comment-core .phabricator-remarkup .remarkup-code-block {
|
||||
width: 88ex;
|
||||
width: 81ch;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-testplan {
|
||||
.phabricator-transaction-view .differential-comment-action-testplan {
|
||||
border-color: #660099;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-abandon {
|
||||
.phabricator-transaction-view .differential-comment-action-abandon {
|
||||
border-color: #222222;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-accept {
|
||||
.phabricator-transaction-view .differential-comment-action-accept {
|
||||
border-color: #009966;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-reject {
|
||||
.phabricator-transaction-view .differential-comment-action-reject {
|
||||
border-color: #aa0000;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-rethink {
|
||||
.phabricator-transaction-view .differential-comment-action-rethink {
|
||||
border-color: #aa0000;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-commit {
|
||||
.phabricator-transaction-view .differential-comment-action-commit {
|
||||
border-color: #006699;
|
||||
}
|
||||
|
||||
|
||||
.differential-comment .differential-comment-action-reclaim {
|
||||
.phabricator-transaction-view .differential-comment-action-reclaim {
|
||||
border-color: #0099aa;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-update {
|
||||
.phabricator-transaction-view .differential-comment-action-update {
|
||||
border-color: #6699cc;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-add_reviewers {
|
||||
.phabricator-transaction-view .differential-comment-action-add_reviewers {
|
||||
border-color: #aa99cc;
|
||||
}
|
||||
|
||||
.differential-comment .differential-comment-action-request_review {
|
||||
.phabricator-transaction-view .differential-comment-action-request_review {
|
||||
border-color: #cc9966;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
* @provides maniphest-transaction-detail-css
|
||||
*/
|
||||
|
||||
.maniphest-transaction-detail-container {
|
||||
margin: 1em 2em 1.25em;
|
||||
background: 0px 2px no-repeat;
|
||||
min-height: 50px;
|
||||
padding: 2px 0px;
|
||||
.maniphest-transaction-list-view {
|
||||
padding: 0 2em;
|
||||
}
|
||||
|
||||
.maniphest-transaction-list-view .anchor-target {
|
||||
|
@ -14,75 +11,46 @@
|
|||
border-color: #ffff00;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .upforgrab {
|
||||
.phabricator-transaction-view .upforgrab {
|
||||
border-color: #cc9966;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .reassigned {
|
||||
.phabricator-transaction-view .reassigned {
|
||||
border-color: #0099aa;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .assigned {
|
||||
.phabricator-transaction-view .assigned {
|
||||
border-color: #0099aa;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .claimed {
|
||||
.phabricator-transaction-view .claimed {
|
||||
border-color: #0099aa;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .created {
|
||||
.phabricator-transaction-view .created {
|
||||
border-color: #660099;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .closed {
|
||||
.phabricator-transaction-view .closed {
|
||||
border-color: #006699;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .spited {
|
||||
.phabricator-transaction-view .spited {
|
||||
border-color: #006699;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .reopened {
|
||||
.phabricator-transaction-view .reopened {
|
||||
border-color: #660099;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .unbreaknow {
|
||||
.phabricator-transaction-view .unbreaknow {
|
||||
border-color: #aa0000;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-container .duplicate {
|
||||
.phabricator-transaction-view .duplicate {
|
||||
border-color: #333333;
|
||||
}
|
||||
|
||||
.maniphest-transaction-header {
|
||||
background: #f3f3f3;
|
||||
padding: 4px 1em;
|
||||
}
|
||||
|
||||
.maniphest-transaction-header a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-view {
|
||||
margin-left: 54px;
|
||||
border-color: #dddddd;
|
||||
border-width: 1px 10px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.maniphest-transaction-timestamp {
|
||||
float: right;
|
||||
font-size: 11px;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.maniphest-transaction-comments {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
padding: 4px 1em;
|
||||
background: #fcfcfc;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.maniphest-change-table {
|
||||
width: 100%;
|
||||
margin: .5em 0em;
|
||||
|
|
Loading…
Reference in a new issue