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

Update EditEngine pages to take a page header separate

Summary: This simplifies EditEngine pages in general by removing the dual header, and extending to allow setting of a custom PHUIHeaderView if needed (like settings).

Test Plan:
Review all settings pages, review task, project pages. This should all be fine, but is a big change maybe some layouts I'm not considering. Tested these all mobile, destkop as well.

{F5166181}

Reviewers: epriestley

Reviewed By: epriestley

Spies: Korvin

Differential Revision: https://secure.phabricator.com/D18527
This commit is contained in:
Chad Little 2017-09-05 20:02:11 -07:00
parent 6e25d4c67b
commit a903388d4f
6 changed files with 50 additions and 18 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array( 'names' => array(
'conpherence.pkg.css' => 'e68cf1fa', 'conpherence.pkg.css' => 'e68cf1fa',
'conpherence.pkg.js' => 'b5b51108', 'conpherence.pkg.js' => 'b5b51108',
'core.pkg.css' => '03264689', 'core.pkg.css' => 'b2235af0',
'core.pkg.js' => '6c085267', 'core.pkg.js' => '6c085267',
'darkconsole.pkg.js' => '1f9a31bc', 'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '45951e9e', 'differential.pkg.css' => '45951e9e',
@ -177,7 +177,7 @@ return array(
'rsrc/css/phui/phui-status.css' => 'd5263e49', 'rsrc/css/phui/phui-status.css' => 'd5263e49',
'rsrc/css/phui/phui-tag-view.css' => 'b4719c50', 'rsrc/css/phui/phui-tag-view.css' => 'b4719c50',
'rsrc/css/phui/phui-timeline-view.css' => 'f21db7ca', 'rsrc/css/phui/phui-timeline-view.css' => 'f21db7ca',
'rsrc/css/phui/phui-two-column-view.css' => 'bf86c483', 'rsrc/css/phui/phui-two-column-view.css' => '1ade9c5f',
'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5', 'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5',
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455', 'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
'rsrc/css/phui/workboards/phui-workcard.css' => 'cca5fa92', 'rsrc/css/phui/workboards/phui-workcard.css' => 'cca5fa92',
@ -872,7 +872,7 @@ return array(
'phui-tag-view-css' => 'b4719c50', 'phui-tag-view-css' => 'b4719c50',
'phui-theme-css' => '9f261c6b', 'phui-theme-css' => '9f261c6b',
'phui-timeline-view-css' => 'f21db7ca', 'phui-timeline-view-css' => 'f21db7ca',
'phui-two-column-view-css' => 'bf86c483', 'phui-two-column-view-css' => '1ade9c5f',
'phui-workboard-color-css' => '783cdff5', 'phui-workboard-color-css' => '783cdff5',
'phui-workboard-view-css' => '3bc85455', 'phui-workboard-view-css' => '3bc85455',
'phui-workcard-view-css' => 'cca5fa92', 'phui-workcard-view-css' => 'cca5fa92',

View file

@ -63,12 +63,13 @@ final class PhabricatorSettingsEditEngine
} }
protected function getObjectEditTitleText($object) { protected function getObjectEditTitleText($object) {
$user = $object->getUser(); $page = $this->getSelectedPage();
if ($user) {
return pht('Edit Settings (%s)', $user->getUserName()); if ($page) {
} else { return $page->getLabel();
return pht('Edit Global Settings');
} }
return pht('Settings');
} }
protected function getObjectEditShortText($object) { protected function getObjectEditShortText($object) {
@ -97,6 +98,20 @@ final class PhabricatorSettingsEditEngine
return pht('Settings'); return pht('Settings');
} }
protected function getPageHeader($object) {
$user = $object->getUser();
if ($user) {
$text = pht('Edit Settings (%s)', $user->getUserName());
} else {
$text = pht('Edit Global Settings');
}
$header = id(new PHUIHeaderView())
->setHeader($text);
return $header;
}
protected function getEditorURI() { protected function getEditorURI() {
throw new PhutilMethodNotImplementedException(); throw new PhutilMethodNotImplementedException();
} }

View file

@ -312,6 +312,15 @@ abstract class PhabricatorEditEngine
} }
/**
* @task text
*/
protected function getPageHeader($object) {
return null;
}
/** /**
* Return a human-readable header describing what this engine is used to do, * Return a human-readable header describing what this engine is used to do,
* like "Configure Maniphest Task Forms". * like "Configure Maniphest Task Forms".
@ -1169,6 +1178,9 @@ abstract class PhabricatorEditEngine
$form = $this->buildEditForm($object, $fields); $form = $this->buildEditForm($object, $fields);
$crumbs = $this->buildCrumbs($object, $final = true);
$crumbs->setBorder(true);
if ($request->isAjax()) { if ($request->isAjax()) {
return $this->getController() return $this->getController()
->newDialog() ->newDialog()
@ -1180,21 +1192,18 @@ abstract class PhabricatorEditEngine
->addSubmitButton($submit_button); ->addSubmitButton($submit_button);
} }
$crumbs = $this->buildCrumbs($object, $final = true); $box_header = id(new PHUIHeaderView())
$header = id(new PHUIHeaderView())
->setHeader($header_text); ->setHeader($header_text);
$crumbs->setBorder(true);
if ($action_button) { if ($action_button) {
$header->addActionLink($action_button); $box_header->addActionLink($action_button);
} }
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setUser($viewer) ->setUser($viewer)
->setHeaderText($this->getObjectName()) ->setHeader($box_header)
->setValidationException($validation_exception) ->setValidationException($validation_exception)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setBackground(PHUIObjectBoxView::WHITE_CONFIG)
->appendChild($form); ->appendChild($form);
// This is fairly questionable, but in use by Settings. // This is fairly questionable, but in use by Settings.
@ -1209,8 +1218,9 @@ abstract class PhabricatorEditEngine
$view = new PHUITwoColumnView(); $view = new PHUITwoColumnView();
if ($header) { $page_header = $this->getPageHeader($object);
$view->setHeader($header); if ($page_header) {
$view->setHeader($page_header);
} }
$page = $controller->newPage() $page = $controller->newPage()

View file

@ -59,7 +59,6 @@ final class PHUIInfoView extends AphrontTagView {
} else { } else {
$icon = id(new PHUIIconView()) $icon = id(new PHUIIconView())
->setIcon($icon); ->setIcon($icon);
$this->icon = $icon;
} }
return $this; return $this;

View file

@ -106,6 +106,10 @@ final class PHUITwoColumnView extends AphrontTagView {
$classes[] = 'with-subheader'; $classes[] = 'with-subheader';
} }
if (!$this->header) {
$classes[] = 'without-header';
}
return array( return array(
'class' => implode(' ', $classes), 'class' => implode(' ', $classes),
); );

View file

@ -13,6 +13,10 @@
margin-bottom: 24px; margin-bottom: 24px;
} }
.phui-two-column-view.without-header {
margin-top: 24px;
}
.device .phui-two-column-view .phui-two-column-header { .device .phui-two-column-view .phui-two-column-header {
margin-bottom: 12px; margin-bottom: 12px;
} }