1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 07:50:57 +01:00

Have TransactionComments return a PHUIObjectBoxView

Summary: Simplifies the code a bit and fixes all the wonky previews. Fixes T4053

Test Plan: Test all pages, logged in and logged out.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4053

Differential Revision: https://secure.phabricator.com/D7622
This commit is contained in:
Chad Little 2013-11-21 16:09:04 -08:00
parent 6ead3a160b
commit b154b07f0e
12 changed files with 110 additions and 154 deletions

View file

@ -1982,7 +1982,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-passphrase-credential-control' =>
array(
'uri' => '/res/b599c028/rsrc/js/application/passphrase/phame-credential-control.js',
'uri' => '/res/e606ad52/rsrc/js/application/passphrase/phame-credential-control.js',
'type' => 'js',
'requires' =>
array(
@ -3882,7 +3882,7 @@ celerity_register_resource_map(array(
),
'phui-form-view-css' =>
array(
'uri' => '/res/3621b05d/rsrc/css/phui/phui-form-view.css',
'uri' => '/res/c77cb7c8/rsrc/css/phui/phui-form-view.css',
'type' => 'css',
'requires' =>
array(
@ -4342,7 +4342,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'68d2c78c' =>
'7bc8b0c9' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -4391,7 +4391,7 @@ celerity_register_resource_map(array(
41 => 'phabricator-tag-view-css',
42 => 'phui-list-view-css',
),
'uri' => '/res/pkg/68d2c78c/core.pkg.css',
'uri' => '/res/pkg/7bc8b0c9/core.pkg.css',
'type' => 'css',
),
'2c1dba03' =>
@ -4583,15 +4583,15 @@ celerity_register_resource_map(array(
),
'reverse' =>
array(
'aphront-dialog-view-css' => '68d2c78c',
'aphront-error-view-css' => '68d2c78c',
'aphront-list-filter-view-css' => '68d2c78c',
'aphront-pager-view-css' => '68d2c78c',
'aphront-panel-view-css' => '68d2c78c',
'aphront-table-view-css' => '68d2c78c',
'aphront-tokenizer-control-css' => '68d2c78c',
'aphront-tooltip-css' => '68d2c78c',
'aphront-typeahead-control-css' => '68d2c78c',
'aphront-dialog-view-css' => '7bc8b0c9',
'aphront-error-view-css' => '7bc8b0c9',
'aphront-list-filter-view-css' => '7bc8b0c9',
'aphront-pager-view-css' => '7bc8b0c9',
'aphront-panel-view-css' => '7bc8b0c9',
'aphront-table-view-css' => '7bc8b0c9',
'aphront-tokenizer-control-css' => '7bc8b0c9',
'aphront-tooltip-css' => '7bc8b0c9',
'aphront-typeahead-control-css' => '7bc8b0c9',
'differential-changeset-view-css' => '1084b12b',
'differential-core-view-css' => '1084b12b',
'differential-inline-comment-editor' => '5e9e5c4e',
@ -4605,7 +4605,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => '1084b12b',
'diffusion-commit-view-css' => '7aa115b4',
'diffusion-icons-css' => '7aa115b4',
'global-drag-and-drop-css' => '68d2c78c',
'global-drag-and-drop-css' => '7bc8b0c9',
'inline-comment-summary-css' => '1084b12b',
'javelin-aphlict' => '2c1dba03',
'javelin-behavior' => '3e3be199',
@ -4680,56 +4680,56 @@ celerity_register_resource_map(array(
'javelin-util' => '3e3be199',
'javelin-vector' => '3e3be199',
'javelin-workflow' => '3e3be199',
'lightbox-attachment-css' => '68d2c78c',
'lightbox-attachment-css' => '7bc8b0c9',
'maniphest-task-summary-css' => '49898640',
'phabricator-action-list-view-css' => '68d2c78c',
'phabricator-application-launch-view-css' => '68d2c78c',
'phabricator-action-list-view-css' => '7bc8b0c9',
'phabricator-application-launch-view-css' => '7bc8b0c9',
'phabricator-busy' => '2c1dba03',
'phabricator-content-source-view-css' => '1084b12b',
'phabricator-core-css' => '68d2c78c',
'phabricator-crumbs-view-css' => '68d2c78c',
'phabricator-core-css' => '7bc8b0c9',
'phabricator-crumbs-view-css' => '7bc8b0c9',
'phabricator-drag-and-drop-file-upload' => '5e9e5c4e',
'phabricator-dropdown-menu' => '2c1dba03',
'phabricator-file-upload' => '2c1dba03',
'phabricator-filetree-view-css' => '68d2c78c',
'phabricator-flag-css' => '68d2c78c',
'phabricator-filetree-view-css' => '7bc8b0c9',
'phabricator-flag-css' => '7bc8b0c9',
'phabricator-hovercard' => '2c1dba03',
'phabricator-jump-nav' => '68d2c78c',
'phabricator-jump-nav' => '7bc8b0c9',
'phabricator-keyboard-shortcut' => '2c1dba03',
'phabricator-keyboard-shortcut-manager' => '2c1dba03',
'phabricator-main-menu-view' => '68d2c78c',
'phabricator-main-menu-view' => '7bc8b0c9',
'phabricator-menu-item' => '2c1dba03',
'phabricator-nav-view-css' => '68d2c78c',
'phabricator-nav-view-css' => '7bc8b0c9',
'phabricator-notification' => '2c1dba03',
'phabricator-notification-css' => '68d2c78c',
'phabricator-notification-menu-css' => '68d2c78c',
'phabricator-notification-css' => '7bc8b0c9',
'phabricator-notification-menu-css' => '7bc8b0c9',
'phabricator-object-selector-css' => '1084b12b',
'phabricator-phtize' => '2c1dba03',
'phabricator-prefab' => '2c1dba03',
'phabricator-project-tag-css' => '49898640',
'phabricator-remarkup-css' => '68d2c78c',
'phabricator-remarkup-css' => '7bc8b0c9',
'phabricator-shaped-request' => '5e9e5c4e',
'phabricator-side-menu-view-css' => '68d2c78c',
'phabricator-standard-page-view' => '68d2c78c',
'phabricator-tag-view-css' => '68d2c78c',
'phabricator-side-menu-view-css' => '7bc8b0c9',
'phabricator-standard-page-view' => '7bc8b0c9',
'phabricator-tag-view-css' => '7bc8b0c9',
'phabricator-textareautils' => '2c1dba03',
'phabricator-tooltip' => '2c1dba03',
'phabricator-transaction-view-css' => '68d2c78c',
'phabricator-zindex-css' => '68d2c78c',
'phui-button-css' => '68d2c78c',
'phui-form-css' => '68d2c78c',
'phui-form-view-css' => '68d2c78c',
'phui-header-view-css' => '68d2c78c',
'phui-icon-view-css' => '68d2c78c',
'phui-list-view-css' => '68d2c78c',
'phui-object-item-list-view-css' => '68d2c78c',
'phui-property-list-view-css' => '68d2c78c',
'phui-spacing-css' => '68d2c78c',
'sprite-apps-large-css' => '68d2c78c',
'sprite-gradient-css' => '68d2c78c',
'sprite-icons-css' => '68d2c78c',
'sprite-menu-css' => '68d2c78c',
'sprite-status-css' => '68d2c78c',
'syntax-highlighting-css' => '68d2c78c',
'phabricator-transaction-view-css' => '7bc8b0c9',
'phabricator-zindex-css' => '7bc8b0c9',
'phui-button-css' => '7bc8b0c9',
'phui-form-css' => '7bc8b0c9',
'phui-form-view-css' => '7bc8b0c9',
'phui-header-view-css' => '7bc8b0c9',
'phui-icon-view-css' => '7bc8b0c9',
'phui-list-view-css' => '7bc8b0c9',
'phui-object-item-list-view-css' => '7bc8b0c9',
'phui-property-list-view-css' => '7bc8b0c9',
'phui-spacing-css' => '7bc8b0c9',
'sprite-apps-large-css' => '7bc8b0c9',
'sprite-gradient-css' => '7bc8b0c9',
'sprite-icons-css' => '7bc8b0c9',
'sprite-menu-css' => '7bc8b0c9',
'sprite-status-css' => '7bc8b0c9',
'syntax-highlighting-css' => '7bc8b0c9',
),
));

View file

@ -94,11 +94,9 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = id(new PHUIHeaderView())
->setHeader(
$is_serious
? pht('Add Comment')
: pht('Question File Integrity'));
$add_comment_header = $is_serious
? pht('Add Comment')
: pht('Question File Integrity');
$submit_button_name = $is_serious
? pht('Add Comment')
@ -110,17 +108,13 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
->setUser($user)
->setObjectPHID($file->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
->setAction($this->getApplicationURI('/comment/'.$file->getID().'/'))
->setSubmitButtonName($submit_button_name);
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->appendChild($add_comment_form);
return array(
$timeline,
$comment_box);
$add_comment_form);
}
private function buildActionView(PhabricatorFile $file) {

View file

@ -196,9 +196,6 @@ final class LegalpadDocumentViewController extends LegalpadController {
? pht('Add Comment')
: pht('Debate Legislation');
$header = id(new PHUIHeaderView())
->setHeader($title);
$button_name = $is_serious
? pht('Add Comment')
: pht('Commence Filibuster');
@ -207,15 +204,13 @@ final class LegalpadDocumentViewController extends LegalpadController {
->setUser($user)
->setObjectPHID($document->getPHID())
->setFormID($comment_form_id)
->setHeaderText($title)
->setDraft($draft)
->setSubmitButtonName($button_name)
->setAction($this->getApplicationURI('/comment/'.$document->getID().'/'))
->setRequestURI($this->getRequest()->getRequestURI());
return id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($header)
->appendChild($form);
return $form;
}

View file

@ -84,11 +84,9 @@ final class PhabricatorMacroViewController
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = id(new PHUIHeaderView())
->setHeader(
$is_serious
? pht('Add Comment')
: pht('Grovel in Awe'));
$comment_header = $is_serious
? pht('Add Comment')
: pht('Grovel in Awe');
$submit_button_name = $is_serious
? pht('Add Comment')
@ -100,6 +98,7 @@ final class PhabricatorMacroViewController
->setUser($user)
->setObjectPHID($macro->getPHID())
->setDraft($draft)
->setHeaderText($comment_header)
->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
->setSubmitButtonName($submit_button_name);
@ -111,17 +110,12 @@ final class PhabricatorMacroViewController
$object_box->addPropertyList($file_view);
}
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->appendChild($add_comment_form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$timeline,
$comment_box,
$add_comment_form,
),
array(
'title' => $title_short,

View file

@ -345,8 +345,9 @@ final class ManiphestTaskDetailController extends ManiphestController {
));
}
$comment_header = id(new PHUIHeaderView())
->setHeader($is_serious ? pht('Add Comment') : pht('Weigh In'));
$comment_header = $is_serious
? pht('Add Comment')
: pht('Weigh In');
$preview_panel = phutil_tag_div(
'aphront-panel-preview',
@ -397,7 +398,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($comment_header)
->setHeaderText($comment_header)
->appendChild($comment_form);
return $this->buildApplicationPage(

View file

@ -117,11 +117,9 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = id(new PHUIHeaderView())
->setHeader(
$is_serious
? pht('Add Comment')
: pht('Debate Paste Accuracy'));
$add_comment_header = $is_serious
? pht('Add Comment')
: pht('Debate Paste Accuracy');
$submit_button_name = $is_serious
? pht('Add Comment')
@ -133,21 +131,17 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
->setUser($user)
->setObjectPHID($paste->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
->setAction($this->getApplicationURI('/comment/'.$paste->getID().'/'))
->setSubmitButtonName($submit_button_name);
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->appendChild($add_comment_form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$source_code,
$timeline,
$comment_box,
$add_comment_form,
),
array(
'title' => $paste->getFullName(),

View file

@ -239,9 +239,6 @@ final class PholioMockViewController extends PholioController {
? pht('Add Comment')
: pht('History Beckons');
$header = id(new PHUIHeaderView())
->setHeader($title);
$button_name = $is_serious
? pht('Add Comment')
: pht('Answer The Call');
@ -251,14 +248,12 @@ final class PholioMockViewController extends PholioController {
->setObjectPHID($mock->getPHID())
->setFormID($comment_form_id)
->setDraft($draft)
->setHeaderText($title)
->setSubmitButtonName($button_name)
->setAction($this->getApplicationURI('/comment/'.$mock->getID().'/'))
->setRequestURI($this->getRequest()->getRequestURI());
return id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($header)
->appendChild($form);
return $form;
}
}

View file

@ -210,19 +210,15 @@ final class PonderQuestionViewController extends PonderController {
->setUser($viewer)
->setObjectPHID($question->getPHID())
->setShowPreview(false)
->setHeaderText(pht('Question Comment'))
->setAction($this->getApplicationURI("/question/comment/{$id}/"))
->setSubmitButtonName(pht('Comment'));
$object_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeaderText(pht('Question Comment'))
->appendChild($add_comment);
return $this->wrapComments(
count($xactions),
array(
$timeline,
$object_box,
$add_comment,
));
}
@ -286,15 +282,11 @@ final class PonderQuestionViewController extends PonderController {
->setUser($viewer)
->setObjectPHID($answer->getPHID())
->setShowPreview(false)
->setHeaderText(pht('Answer Comment'))
->setAction($this->getApplicationURI("/answer/comment/{$id}/"))
->setSubmitButtonName(pht('Comment'));
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeaderText(pht('Answer Comment'))
->appendChild($form);
$details[] = $comment_box;
$details[] = $form;
$out[] = $this->wrapComments(
count($xactions),

View file

@ -54,25 +54,25 @@ final class ReleephRequestViewController extends ReleephProjectController {
->setTransactions($xactions)
->setMarkupEngine($engine);
$add_comment_header = id(new PHUIHeaderView())
->setHeader('Plea or yield');
$add_comment_header = pht('Plea or yield');
$draft = PhabricatorDraft::newFromUserAndKey(
$user,
$releeph_request->getPHID());
$title = hsprintf("RQ%d: %s",
$releeph_request->getID(),
$releeph_request->getSummaryForDisplay());
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
->setUser($user)
->setObjectPHID($releeph_request->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
->setAction($this->getApplicationURI(
'/request/comment/'.$releeph_request->getID().'/'))
->setSubmitButtonName('Comment');
$title = hsprintf("RQ%d: %s",
$releeph_request->getID(),
$releeph_request->getSummaryForDisplay());
$crumbs = $this->buildApplicationCrumbs()
->addCrumb(
id(new PhabricatorCrumbView())
@ -93,7 +93,6 @@ final class ReleephRequestViewController extends ReleephProjectController {
array(
$rq_view,
$timeline,
$add_comment_header,
$add_comment_form,
)
),

View file

@ -162,11 +162,9 @@ final class PhabricatorSlowvotePollController
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = id(new PHUIHeaderView())
->setHeader(
$is_serious
? pht('Add Comment')
: pht('Enter Deliberations'));
$add_comment_header = $is_serious
? pht('Add Comment')
: pht('Enter Deliberations');
$submit_button_name = $is_serious
? pht('Add Comment')
@ -174,18 +172,14 @@ final class PhabricatorSlowvotePollController
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $poll->getPHID());
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
return id(new PhabricatorApplicationTransactionCommentView())
->setUser($viewer)
->setObjectPHID($poll->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
->setAction($this->getApplicationURI('/comment/'.$poll->getID().'/'))
->setSubmitButtonName($submit_button_name);
return id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->appendChild($add_comment_form);
}
}

View file

@ -18,6 +18,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
private $requestURI;
private $showPreview = true;
private $objectPHID;
private $headerText;
public function setObjectPHID($object_phid) {
$this->objectPHID = $object_phid;
@ -72,25 +73,28 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
return $this->action;
}
public function setHeaderText($text) {
$this->headerText = $text;
return $this;
}
public function render() {
$user = $this->getUser();
if (!$user->isLoggedIn()) {
$uri = id(new PhutilURI('/login/'))
->setQueryParam('next', (string) $this->getRequestURI());
return phutil_tag(
'div',
array(
'class' => 'login-to-comment'
),
javelin_tag(
'a',
array(
'class' => 'button',
'sigil' => 'workflow',
'href' => $uri
),
pht('Login to Comment')));
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Add Comment'))
->appendChild(
javelin_tag(
'a',
array(
'class' => 'login-to-comment button',
'sigil' => 'workflow',
'href' => $uri
),
pht('Login to Comment')));
}
$data = array();
@ -124,7 +128,12 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
: null,
));
return array($comment, $preview);
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeaderText($this->headerText)
->appendChild($comment);
return array($comment_box, $preview);
}
private function renderCommentPanel() {
@ -174,23 +183,13 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
$preview = id(new PhabricatorTimelineView())
->setID($this->getPreviewTimelineID());
$header = phutil_tag(
'div',
array(
'class' => 'phabricator-timeline-preview-header',
),
pht('Preview'));
return phutil_tag(
'div',
array(
'id' => $this->getPreviewPanelID(),
'style' => 'display: none',
),
array(
$header,
$preview,
));
$preview);
}
private function getPreviewPanelID() {

View file

@ -411,8 +411,7 @@ table.aphront-form-control-checkbox-layout th {
}
.login-to-comment {
padding: 12px;
float: right;
margin: 12px;
}
.phui-form-divider hr {