1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

Provide more structure to PHUIObjectBoxView

Summary:
Three changes here.

  - Add `setActionList()`, and use that to set the action list.
  - Add `setPropertyList()`, and use that to set the property list.

These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.

  - Replace `addContent()` with `appendChild()`.

This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.

Test Plan:
  - Viewed "All Config".
  - Viewed a countdown.
  - Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
  - Viewed Diffusion (browse, change, history, repository, lint).
  - Viewed Drydock (resource, lease).
  - Viewed Files.
  - Viewed Herald.
  - Viewed Legalpad.
  - Viewed macro (edit, edit audio, view).
  - Viewed Maniphest.
  - Viewed Applications.
  - Viewed Paste.
  - Viewed People.
  - Viewed Phulux.
  - Viewed Pholio.
  - Viewed Phame (blog, post).
  - Viewed Phortune (account, product).
  - Viewed Ponder (questions, answers, comments).
  - Viewed Releeph.
  - Viewed Projects.
  - Viewed Slowvote.

NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?

NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D7174
This commit is contained in:
epriestley 2013-09-30 09:36:04 -07:00
parent 6a74ad724b
commit b592630d72
41 changed files with 106 additions and 101 deletions

View file

@ -74,7 +74,7 @@ final class PhabricatorConfigAllController
$object_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Current Settings'))
->addContent($version_property_list);
->setPropertyList($version_property_list);
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
$version_path = $phabricator_root.'/conf/local/VERSION';

View file

@ -49,8 +49,8 @@ final class PhabricatorCountdownViewController
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$content = array(
$crumbs,

View file

@ -872,7 +872,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Open Revisions Affecting These Files'))
->addContent($view);
->appendChild($view);
}
/**

View file

@ -195,9 +195,9 @@ final class DifferentialAddCommentView extends AphrontView {
$comment_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($anchor)
->addContent($warn)
->addContent($form);
->appendChild($anchor)
->appendChild($warn)
->appendChild($form);
return array($comment_box, $preview);
}

View file

@ -210,7 +210,7 @@ final class DifferentialChangesetListView extends AphrontView {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($content);
->appendChild($content);
return $object_box;
}

View file

@ -239,7 +239,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Table of Contents'))
->addContent($content);
->appendChild($content);
}
private function renderRename($display_file, $other_file, $arrow) {

View file

@ -137,8 +137,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Local Commits'))
->addContent($content);
->appendChild($content);
}
private static function formatCommit($commit) {

View file

@ -113,8 +113,8 @@ final class DifferentialRevisionDetailView extends AphrontView {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $object_box;
}

View file

@ -220,7 +220,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Revision Update History'))
->addContent($content);
->appendChild($content);
}
const STAR_NONE = 'none';

View file

@ -24,8 +24,8 @@ final class DiffusionBrowseDirectoryController
$object_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderView($drequest))
->addContent($this->buildActionView($drequest))
->addContent($this->buildPropertyView($drequest));
->setActionList($this->buildActionView($drequest))
->setPropertyList($this->buildPropertyView($drequest));
$content[] = $object_box;
$content[] = $this->renderSearchForm($collapsed = true);
@ -77,7 +77,7 @@ final class DiffusionBrowseDirectoryController
$object_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('README'))
->addContent($box);
->appendChild($box);
$content[] = $object_box;
}

View file

@ -100,8 +100,8 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderView($drequest))
->addContent($this->buildActionView($drequest))
->addContent($this->buildPropertyView($drequest));
->setActionList($this->buildActionView($drequest))
->setPropertyList($this->buildPropertyView($drequest));
// Render the page.
$content = array();

View file

@ -7,8 +7,8 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderView($drequest))
->addContent($this->buildActionView($drequest))
->addContent($this->buildPropertyView($drequest));
->setActionList($this->buildActionView($drequest))
->setPropertyList($this->buildPropertyView($drequest));
$content = array();

View file

@ -84,8 +84,8 @@ final class DiffusionChangeController extends DiffusionController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -140,8 +140,8 @@ final class DiffusionCommitController extends DiffusionController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($headsup_view)
->addContent($headsup_actions)
->addContent($property_list);
->setActionList($headsup_actions)
->setPropertyList($property_list);
$content[] = $object_box;
}
@ -743,7 +743,7 @@ final class DiffusionCommitController extends DiffusionController {
$comment_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($form);
->appendChild($form);
return phutil_tag(
'div',

View file

@ -74,8 +74,8 @@ final class DiffusionHistoryController extends DiffusionController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$crumbs = $this->buildCrumbs(
array(

View file

@ -168,8 +168,8 @@ final class DiffusionLintController extends DiffusionController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
} else {
$object_box = null;
}

View file

@ -176,8 +176,8 @@ final class DiffusionRepositoryController extends DiffusionController {
return id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($view);
->setActionList($actions)
->setPropertyList($view);
}

View file

@ -47,8 +47,8 @@ final class DrydockLeaseViewController extends DrydockController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -58,8 +58,8 @@ final class DrydockResourceViewController extends DrydockController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -51,8 +51,8 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(
@ -113,7 +113,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->addContent($add_comment_form);
->appendChild($add_comment_form);
return array(
$timeline,

View file

@ -34,8 +34,8 @@ final class HeraldRuleViewController extends HeraldController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -88,8 +88,8 @@ final class LegalpadDocumentViewController extends LegalpadController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$content = array(
$crumbs,
@ -216,7 +216,7 @@ final class LegalpadDocumentViewController extends LegalpadController {
return id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($header)
->addContent($form);
->appendChild($form);
}

View file

@ -93,13 +93,13 @@ final class PhabricatorMacroViewController
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->addContent($add_comment_form);
->appendChild($add_comment_form);
return $this->buildApplicationPage(
array(

View file

@ -365,13 +365,13 @@ final class ManiphestTaskDetailController extends ManiphestController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($comment_header)
->addContent($comment_form);
->appendChild($comment_form);
return $this->buildApplicationPage(
array(

View file

@ -56,8 +56,8 @@ final class PhabricatorApplicationDetailViewController
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -71,8 +71,8 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$source_code = $this->buildSourceCodeView(
$paste,
@ -139,7 +139,7 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->addContent($add_comment_form);
->appendChild($add_comment_form);
return $this->buildApplicationPage(
array(

View file

@ -78,8 +78,8 @@ final class PhabricatorPeopleProfileController
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -65,8 +65,8 @@ final class PhameBlogViewController extends PhameController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$nav->appendChild(
array(

View file

@ -50,8 +50,8 @@ final class PhamePostViewController extends PhameController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
if ($post->isDraft()) {
$object_box->appendChild(

View file

@ -76,8 +76,8 @@ final class PhluxViewController extends PhluxController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -105,8 +105,8 @@ final class PholioMockViewController extends PholioController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$content = array(
$crumbs,
@ -257,7 +257,7 @@ final class PholioMockViewController extends PholioController {
return id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($header)
->addContent($form);
->appendChild($form);
}
}

View file

@ -62,8 +62,8 @@ final class PhortuneAccountViewController extends PhortuneController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -83,8 +83,8 @@ final class PhortuneProductViewController extends PhortuneController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(

View file

@ -52,8 +52,8 @@ final class PonderQuestionViewController extends PonderController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
$crumbs->setActionList($actions);
@ -214,7 +214,7 @@ final class PonderQuestionViewController extends PonderController {
$object_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeaderText(pht('Question Comment'))
->addContent($add_comment);
->appendChild($add_comment);
return $this->wrapComments(
count($xactions),
@ -269,8 +269,8 @@ final class PonderQuestionViewController extends PonderController {
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
$out[] = $object_box;
$details = array();
@ -291,7 +291,7 @@ final class PonderQuestionViewController extends PonderController {
$comment_box = id(new PHUIObjectBoxView())
->setFlush(true)
->setHeaderText(pht('Answer Comment'))
->addContent($form);
->appendChild($form);
$details[] = $comment_box;

View file

@ -45,6 +45,6 @@ final class PonderAddAnswerView extends AphrontView {
return id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($form);
->appendChild($form);
}
}

View file

@ -74,8 +74,8 @@ final class PhabricatorProjectProfileController
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(
@ -182,7 +182,7 @@ final class PhabricatorProjectProfileController
$content = id(new PHUIObjectBoxView())
->setHeaderText(pht('Open Tasks'))
->addContent($list);
->appendChild($list);
return $content;
}

View file

@ -170,9 +170,8 @@ final class ReleephBranchViewController extends ReleephProjectController
return id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
}
}

View file

@ -238,9 +238,8 @@ final class ReleephProjectViewController extends ReleephProjectController
return id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
}
}

View file

@ -59,8 +59,8 @@ final class PhabricatorSlowvotePollController
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addContent($actions)
->addContent($properties);
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(
@ -181,7 +181,7 @@ final class PhabricatorSlowvotePollController
return id(new PHUIObjectBoxView())
->setFlush(true)
->setHeader($add_comment_header)
->addContent($add_comment_form);
->appendChild($add_comment_form);
}

View file

@ -6,9 +6,20 @@ final class PHUIObjectBoxView extends AphrontView {
private $formError = null;
private $form;
private $validationException;
private $content = array();
private $header;
private $flush;
private $propertyList;
private $actionList;
public function setActionList(PhabricatorActionListView $action_list) {
$this->actionList = $action_list;
return $this;
}
public function setPropertyList(PhabricatorPropertyListView $property_list) {
$this->propertyList = $property_list;
return $this;
}
public function setHeaderText($text) {
$this->headerText = $text;
@ -30,11 +41,6 @@ final class PHUIObjectBoxView extends AphrontView {
return $this;
}
public function addContent($content) {
$this->content[] = $content;
return $this;
}
public function setFlush($flush) {
$this->flush = $flush;
return $this;
@ -79,7 +85,9 @@ final class PHUIObjectBoxView extends AphrontView {
$this->formError,
$exception_errors,
$this->form,
$this->content,
$this->actionList,
$this->propertyList,
$this->renderChildren(),
))
->setBorder(true)
->addMargin(PHUI::MARGIN_LARGE_TOP)