mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Moderize Pholio UI
Summary: Cleans up Pholio, moves to two column layout, fix some transaction inconsistencies. This moves "Image" to the MainColumn, which feels fine, but I think we'll likely want some sort of "fullscreen" option for Pholio V2 like we have on workboards perhaps. Test Plan: New Mock, Edit Mock, View Mock. {F1200450} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15564
This commit is contained in:
parent
7a6acd57fa
commit
ff4a63a954
5 changed files with 120 additions and 84 deletions
|
@ -22,7 +22,8 @@ final class PholioMockEditController extends PholioController {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = pht('Edit Mock');
|
$title = pht('Edit Mock: %s', $mock->getName());
|
||||||
|
$header_icon = 'fa-pencil';
|
||||||
|
|
||||||
$is_new = false;
|
$is_new = false;
|
||||||
$mock_images = $mock->getImages();
|
$mock_images = $mock->getImages();
|
||||||
|
@ -32,6 +33,7 @@ final class PholioMockEditController extends PholioController {
|
||||||
$mock = PholioMock::initializeNewMock($viewer);
|
$mock = PholioMock::initializeNewMock($viewer);
|
||||||
|
|
||||||
$title = pht('Create Mock');
|
$title = pht('Create Mock');
|
||||||
|
$header_icon = 'fa-plus-square';
|
||||||
|
|
||||||
$is_new = true;
|
$is_new = true;
|
||||||
$files = array();
|
$files = array();
|
||||||
|
@ -350,8 +352,9 @@ final class PholioMockEditController extends PholioController {
|
||||||
->appendChild($submit);
|
->appendChild($submit);
|
||||||
|
|
||||||
$form_box = id(new PHUIObjectBoxView())
|
$form_box = id(new PHUIObjectBoxView())
|
||||||
->setHeaderText($title)
|
->setHeaderText(pht('Mock'))
|
||||||
->setFormErrors($errors)
|
->setFormErrors($errors)
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
->setForm($form);
|
->setForm($form);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
@ -359,21 +362,22 @@ final class PholioMockEditController extends PholioController {
|
||||||
$crumbs->addTextCrumb($mock->getMonogram(), '/'.$mock->getMonogram());
|
$crumbs->addTextCrumb($mock->getMonogram(), '/'.$mock->getMonogram());
|
||||||
}
|
}
|
||||||
$crumbs->addTextCrumb($title);
|
$crumbs->addTextCrumb($title);
|
||||||
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
$content = array(
|
$header = id(new PHUIHeaderView())
|
||||||
$crumbs,
|
->setHeader($title)
|
||||||
$form_box,
|
->setHeaderIcon($header_icon);
|
||||||
);
|
|
||||||
|
$view = id(new PHUITwoColumnView())
|
||||||
|
->setHeader($header)
|
||||||
|
->setFooter($form_box);
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setTitle($title)
|
->setTitle($title)
|
||||||
->setCrumbs($crumbs)
|
->setCrumbs($crumbs)
|
||||||
->addQuicksandConfig(
|
->addQuicksandConfig(
|
||||||
array('mockEditConfig' => true))
|
array('mockEditConfig' => true))
|
||||||
->appendChild(
|
->appendChild($view);
|
||||||
array(
|
|
||||||
$form_box,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ final class PholioMockViewController extends PholioController {
|
||||||
->setHeader($title)
|
->setHeader($title)
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setStatus($header_icon, $header_color, $header_name)
|
->setStatus($header_icon, $header_color, $header_name)
|
||||||
->setPolicyObject($mock);
|
->setPolicyObject($mock)
|
||||||
|
->setHeaderIcon('fa-camera-retro');
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$mock,
|
$mock,
|
||||||
|
@ -65,8 +66,8 @@ final class PholioMockViewController extends PholioController {
|
||||||
$engine);
|
$engine);
|
||||||
$timeline->setMock($mock);
|
$timeline->setMock($mock);
|
||||||
|
|
||||||
$actions = $this->buildActionView($mock);
|
$curtain = $this->buildCurtainView($mock);
|
||||||
$properties = $this->buildPropertyView($mock, $engine, $actions);
|
$details = $this->buildDescriptionView($mock, $engine);
|
||||||
|
|
||||||
require_celerity_resource('pholio-css');
|
require_celerity_resource('pholio-css');
|
||||||
require_celerity_resource('pholio-inline-comments-css');
|
require_celerity_resource('pholio-inline-comments-css');
|
||||||
|
@ -80,51 +81,50 @@ final class PholioMockViewController extends PholioController {
|
||||||
->setImageID($image_id);
|
->setImageID($image_id);
|
||||||
|
|
||||||
$output = id(new PHUIObjectBoxView())
|
$output = id(new PHUIObjectBoxView())
|
||||||
->setHeaderText(pht('Image'))
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
->appendChild($mock_view);
|
->appendChild($mock_view);
|
||||||
|
|
||||||
$add_comment = $this->buildAddCommentView($mock, $comment_form_id);
|
$add_comment = $this->buildAddCommentView($mock, $comment_form_id);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb('M'.$mock->getID(), '/M'.$mock->getID());
|
$crumbs->addTextCrumb('M'.$mock->getID(), '/M'.$mock->getID());
|
||||||
|
$crumbs->setBorder(true);
|
||||||
$object_box = id(new PHUIObjectBoxView())
|
|
||||||
->setHeader($header)
|
|
||||||
->addPropertyList($properties);
|
|
||||||
|
|
||||||
$thumb_grid = id(new PholioMockThumbGridView())
|
$thumb_grid = id(new PholioMockThumbGridView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setMock($mock);
|
->setMock($mock);
|
||||||
|
|
||||||
|
$view = id(new PHUITwoColumnView())
|
||||||
|
->setHeader($header)
|
||||||
|
->setCurtain($curtain)
|
||||||
|
->setMainColumn(array(
|
||||||
|
$output,
|
||||||
|
$thumb_grid,
|
||||||
|
$details,
|
||||||
|
$timeline,
|
||||||
|
$add_comment,
|
||||||
|
));
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setTitle('M'.$mock->getID().' '.$title)
|
->setTitle('M'.$mock->getID().' '.$title)
|
||||||
->setCrumbs($crumbs)
|
->setCrumbs($crumbs)
|
||||||
->setPageObjectPHIDs(array($mock->getPHID()))
|
->setPageObjectPHIDs(array($mock->getPHID()))
|
||||||
->addQuicksandConfig(
|
->addQuicksandConfig(
|
||||||
array('mockViewConfig' => $mock_view->getBehaviorConfig()))
|
array('mockViewConfig' => $mock_view->getBehaviorConfig()))
|
||||||
->appendChild(
|
->appendChild($view);
|
||||||
array(
|
|
||||||
$object_box,
|
|
||||||
$output,
|
|
||||||
$thumb_grid,
|
|
||||||
$timeline,
|
|
||||||
$add_comment,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildActionView(PholioMock $mock) {
|
private function buildCurtainView(PholioMock $mock) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$actions = id(new PhabricatorActionListView())
|
$curtain = $this->newCurtainView($mock);
|
||||||
->setUser($viewer)
|
|
||||||
->setObject($mock);
|
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
$viewer,
|
$viewer,
|
||||||
$mock,
|
$mock,
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
$actions->addAction(
|
$curtain->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setIcon('fa-pencil')
|
->setIcon('fa-pencil')
|
||||||
->setName(pht('Edit Mock'))
|
->setName(pht('Edit Mock'))
|
||||||
|
@ -133,7 +133,7 @@ final class PholioMockViewController extends PholioController {
|
||||||
->setWorkflow(!$can_edit));
|
->setWorkflow(!$can_edit));
|
||||||
|
|
||||||
if ($mock->isClosed()) {
|
if ($mock->isClosed()) {
|
||||||
$actions->addAction(
|
$curtain->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setIcon('fa-check')
|
->setIcon('fa-check')
|
||||||
->setName(pht('Open Mock'))
|
->setName(pht('Open Mock'))
|
||||||
|
@ -141,7 +141,7 @@ final class PholioMockViewController extends PholioController {
|
||||||
->setDisabled(!$can_edit)
|
->setDisabled(!$can_edit)
|
||||||
->setWorkflow(true));
|
->setWorkflow(true));
|
||||||
} else {
|
} else {
|
||||||
$actions->addAction(
|
$curtain->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setIcon('fa-ban')
|
->setIcon('fa-ban')
|
||||||
->setName(pht('Close Mock'))
|
->setName(pht('Close Mock'))
|
||||||
|
@ -150,7 +150,7 @@ final class PholioMockViewController extends PholioController {
|
||||||
->setWorkflow(true));
|
->setWorkflow(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions->addAction(
|
$curtain->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setIcon('fa-anchor')
|
->setIcon('fa-anchor')
|
||||||
->setName(pht('Edit Maniphest Tasks'))
|
->setName(pht('Edit Maniphest Tasks'))
|
||||||
|
@ -158,45 +158,56 @@ final class PholioMockViewController extends PholioController {
|
||||||
->setDisabled(!$viewer->isLoggedIn())
|
->setDisabled(!$viewer->isLoggedIn())
|
||||||
->setWorkflow(true));
|
->setWorkflow(true));
|
||||||
|
|
||||||
return $actions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildPropertyView(
|
|
||||||
PholioMock $mock,
|
|
||||||
PhabricatorMarkupEngine $engine,
|
|
||||||
PhabricatorActionListView $actions) {
|
|
||||||
|
|
||||||
$viewer = $this->getViewer();
|
|
||||||
|
|
||||||
$properties = id(new PHUIPropertyListView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setObject($mock)
|
|
||||||
->setActionList($actions);
|
|
||||||
|
|
||||||
$properties->addProperty(
|
|
||||||
pht('Author'),
|
|
||||||
$viewer->renderHandle($mock->getAuthorPHID()));
|
|
||||||
|
|
||||||
$properties->addProperty(
|
|
||||||
pht('Created'),
|
|
||||||
phabricator_datetime($mock->getDateCreated(), $viewer));
|
|
||||||
|
|
||||||
if ($this->getManiphestTaskPHIDs()) {
|
if ($this->getManiphestTaskPHIDs()) {
|
||||||
$properties->addProperty(
|
$curtain->newPanel()
|
||||||
pht('Maniphest Tasks'),
|
->setHeaderText(pht('Maniphest Tasks'))
|
||||||
|
->appendChild(
|
||||||
$viewer->renderHandleList($this->getManiphestTaskPHIDs()));
|
$viewer->renderHandleList($this->getManiphestTaskPHIDs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$properties->invokeWillRenderEvent();
|
$curtain->newPanel()
|
||||||
|
->setHeaderText(pht('Authored By'))
|
||||||
|
->appendChild($this->buildAuthorPanel($mock));
|
||||||
|
|
||||||
$properties->addSectionHeader(
|
return $curtain;
|
||||||
pht('Description'),
|
}
|
||||||
PHUIPropertyListView::ICON_SUMMARY);
|
|
||||||
|
|
||||||
$properties->addImageContent(
|
private function buildDescriptionView(PholioMock $mock) {
|
||||||
$engine->getOutput($mock, PholioMock::MARKUP_FIELD_DESCRIPTION));
|
|
||||||
|
|
||||||
return $properties;
|
$viewer = $this->getViewer();
|
||||||
|
$properties = id(new PHUIPropertyListView())
|
||||||
|
->setUser($viewer);
|
||||||
|
$description = $mock->getDescription();
|
||||||
|
|
||||||
|
if (strlen($description)) {
|
||||||
|
$properties->addImageContent($description);
|
||||||
|
return id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Mock Description'))
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->appendChild($properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildAuthorPanel(PholioMock $mock) {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
$author_phid = $mock->getAuthorPHID();
|
||||||
|
$handles = $viewer->loadHandles(array($author_phid));
|
||||||
|
|
||||||
|
$author_uri = $handles[$author_phid]->getImageURI();
|
||||||
|
$author_href = $handles[$author_phid]->getURI();
|
||||||
|
$author = $viewer->renderHandle($author_phid)->render();
|
||||||
|
|
||||||
|
$content = phutil_tag('strong', array(), $author);
|
||||||
|
$date = phabricator_date($mock->getDateCreated(), $viewer);
|
||||||
|
$content = pht('%s, %s', $content, $date);
|
||||||
|
$authored_by = id(new PHUIHeadThingView())
|
||||||
|
->setImage($author_uri)
|
||||||
|
->setImageHref($author_href)
|
||||||
|
->setContent($content);
|
||||||
|
|
||||||
|
return $authored_by;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildAddCommentView(PholioMock $mock, $comment_form_id) {
|
private function buildAddCommentView(PholioMock $mock, $comment_form_id) {
|
||||||
|
|
|
@ -227,12 +227,10 @@ final class PholioMock extends PholioDAO
|
||||||
|
|
||||||
public function getMarkupText($field) {
|
public function getMarkupText($field) {
|
||||||
if ($this->getDescription()) {
|
if ($this->getDescription()) {
|
||||||
$description = $this->getDescription();
|
return $this->getDescription();
|
||||||
} else {
|
|
||||||
$description = pht('No Description Given');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $description;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
||||||
|
|
|
@ -81,12 +81,21 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
|
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_INLINE:
|
case self::TYPE_INLINE:
|
||||||
return 'fa-comment';
|
return 'fa-comment';
|
||||||
case self::TYPE_NAME:
|
case self::TYPE_NAME:
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
case self::TYPE_STATUS:
|
case self::TYPE_STATUS:
|
||||||
|
if ($new == PholioMock::STATUS_CLOSED) {
|
||||||
|
return 'fa-ban';
|
||||||
|
} else {
|
||||||
|
return 'fa-check';
|
||||||
|
}
|
||||||
case self::TYPE_IMAGE_NAME:
|
case self::TYPE_IMAGE_NAME:
|
||||||
case self::TYPE_IMAGE_DESCRIPTION:
|
case self::TYPE_IMAGE_DESCRIPTION:
|
||||||
case self::TYPE_IMAGE_SEQUENCE:
|
case self::TYPE_IMAGE_SEQUENCE:
|
||||||
|
@ -153,9 +162,15 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
|
||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
break;
|
break;
|
||||||
case self::TYPE_STATUS:
|
case self::TYPE_STATUS:
|
||||||
|
if ($new == PholioMock::STATUS_CLOSED) {
|
||||||
return pht(
|
return pht(
|
||||||
"%s updated the mock's status.",
|
'%s closed this mock.',
|
||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s opened this mock.',
|
||||||
|
$this->renderHandleLink($author_phid));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case self::TYPE_INLINE:
|
case self::TYPE_INLINE:
|
||||||
$count = 1;
|
$count = 1;
|
||||||
|
@ -260,10 +275,17 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
|
||||||
$this->renderHandleLink($object_phid));
|
$this->renderHandleLink($object_phid));
|
||||||
break;
|
break;
|
||||||
case self::TYPE_STATUS:
|
case self::TYPE_STATUS:
|
||||||
|
if ($new == PholioMock::STATUS_CLOSED) {
|
||||||
return pht(
|
return pht(
|
||||||
'%s updated the status for %s.',
|
'%s closed a mock %s.',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->renderHandleLink($object_phid));
|
$this->renderHandleLink($object_phid));
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s opened a mock %s.',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case self::TYPE_INLINE:
|
case self::TYPE_INLINE:
|
||||||
return pht(
|
return pht(
|
||||||
|
@ -347,16 +369,16 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
|
||||||
$new = $this->getNewValue();
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
|
case self::TYPE_STATUS:
|
||||||
|
if ($new == PholioMock::STATUS_CLOSED) {
|
||||||
|
return PhabricatorTransactions::COLOR_INDIGO;
|
||||||
|
} else {
|
||||||
|
return PhabricatorTransactions::COLOR_GREEN;
|
||||||
|
}
|
||||||
case self::TYPE_NAME:
|
case self::TYPE_NAME:
|
||||||
if ($old === null) {
|
if ($old === null) {
|
||||||
return PhabricatorTransactions::COLOR_GREEN;
|
return PhabricatorTransactions::COLOR_GREEN;
|
||||||
}
|
}
|
||||||
case self::TYPE_DESCRIPTION:
|
|
||||||
case self::TYPE_STATUS:
|
|
||||||
case self::TYPE_IMAGE_NAME:
|
|
||||||
case self::TYPE_IMAGE_DESCRIPTION:
|
|
||||||
case self::TYPE_IMAGE_SEQUENCE:
|
|
||||||
return PhabricatorTransactions::COLOR_BLUE;
|
|
||||||
case self::TYPE_IMAGE_REPLACE:
|
case self::TYPE_IMAGE_REPLACE:
|
||||||
return PhabricatorTransactions::COLOR_YELLOW;
|
return PhabricatorTransactions::COLOR_YELLOW;
|
||||||
case self::TYPE_IMAGE_FILE:
|
case self::TYPE_IMAGE_FILE:
|
||||||
|
|
|
@ -107,6 +107,7 @@ final class PholioMockThumbGridView extends AphrontView {
|
||||||
|
|
||||||
return id(new PHUIObjectBoxView())
|
return id(new PHUIObjectBoxView())
|
||||||
->setHeaderText(pht('Mock History'))
|
->setHeaderText(pht('Mock History'))
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
->appendChild($grid);
|
->appendChild($grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue