Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15464081
D15372.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D15372.id.diff
View Options
diff --git a/src/applications/macro/controller/PhabricatorMacroViewController.php b/src/applications/macro/controller/PhabricatorMacroViewController.php
--- a/src/applications/macro/controller/PhabricatorMacroViewController.php
+++ b/src/applications/macro/controller/PhabricatorMacroViewController.php
@@ -20,29 +20,18 @@
return new Aphront404Response();
}
- $file = $macro->getFile();
-
$title_short = pht('Macro "%s"', $macro->getName());
$title_long = pht('Image Macro "%s"', $macro->getName());
$actions = $this->buildActionView($macro);
+ $subheader = $this->buildSubheaderView($macro);
+ $properties = $this->buildPropertyView($macro);
+ $file = $this->buildFileView($macro);
+ $details = $this->buildPropertySectionView($macro);
$crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(
- $title_short,
- $this->getApplicationURI('/view/'.$macro->getID().'/'));
-
- $properties = $this->buildPropertyView($macro, $actions);
- if ($file) {
- $file_view = new PHUIPropertyListView();
- $file_view->addImageContent(
- phutil_tag(
- 'img',
- array(
- 'src' => $file->getViewURI(),
- 'class' => 'phabricator-image-macro-hero',
- )));
- }
+ $crumbs->addTextCrumb($macro->getName());
+ $crumbs->setBorder(true);
$timeline = $this->buildTransactionTimeline(
$macro,
@@ -75,28 +64,30 @@
->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
->setSubmitButtonName(pht('Add Comment'));
- $object_box = id(new PHUIObjectBoxView())
+ $view = id(new PHUITwoColumnView())
->setHeader($header)
- ->addPropertyList($properties);
-
- if ($file_view) {
- $object_box->addPropertyList($file_view);
- }
-
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $object_box,
+ ->setSubheader($subheader)
+ ->setMainColumn(array(
$timeline,
$add_comment_form,
- ),
- array(
- 'title' => $title_short,
- 'pageObjects' => array($macro->getPHID()),
+ ))
+ ->addPropertySection(pht('MACRO'), $file)
+ ->addPropertySection(pht('DETAILS'), $details)
+ ->setPropertyList($properties)
+ ->setActionList($actions);
+
+ return $this->newPage()
+ ->setTitle($title_short)
+ ->setCrumbs($crumbs)
+ ->setPageObjectPHIDs(array($macro->getPHID()))
+ ->appendChild(
+ array(
+ $view,
));
}
- private function buildActionView(PhabricatorFileImageMacro $macro) {
+ private function buildActionView(
+ PhabricatorFileImageMacro $macro) {
$can_manage = $this->hasApplicationCapability(
PhabricatorMacroManageCapability::CAPABILITY);
@@ -141,15 +132,34 @@
return $view;
}
- private function buildPropertyView(
- PhabricatorFileImageMacro $macro,
- PhabricatorActionListView $actions) {
+ private function buildSubheaderView(
+ PhabricatorFileImageMacro $macro) {
+ $viewer = $this->getViewer();
+
+ $author_phid = $macro->getAuthorPHID();
+
+ $author = $viewer->renderHandle($author_phid)->render();
+ $date = phabricator_datetime($macro->getDateCreated(), $viewer);
+ $author = phutil_tag('strong', array(), $author);
+
+ $handles = $viewer->loadHandles(array($author_phid));
+ $image_uri = $handles[$author_phid]->getImageURI();
+ $image_href = $handles[$author_phid]->getURI();
+
+ $content = pht('Masterfully imagined by %s on %s.', $author, $date);
+
+ return id(new PHUIHeadThingView())
+ ->setImage($image_uri)
+ ->setImageHref($image_href)
+ ->setContent($content);
+ }
+
+ private function buildPropertySectionView(
+ PhabricatorFileImageMacro $macro) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
- ->setUser($this->getRequest()->getUser())
- ->setObject($macro)
- ->setActionList($actions);
+ ->setUser($viewer);
switch ($macro->getAudioBehavior()) {
case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:
@@ -167,6 +177,38 @@
$viewer->renderHandle($audio_phid));
}
+ return $view;
+ }
+
+ private function buildFileView(
+ PhabricatorFileImageMacro $macro) {
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setUser($viewer);
+
+ $file = $macro->getFile();
+ if ($file) {
+ $view->addImageContent(
+ phutil_tag(
+ 'img',
+ array(
+ 'src' => $file->getViewURI(),
+ 'class' => 'phabricator-image-macro-hero',
+ )));
+ return $view;
+ }
+ return null;
+ }
+
+ private function buildPropertyView(
+ PhabricatorFileImageMacro $macro) {
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setUser($this->getRequest()->getUser())
+ ->setObject($macro);
+
$view->invokeWillRenderEvent();
return $view;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 3, 6:20 AM (2 w, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7390622
Default Alt Text
D15372.id.diff (4 KB)
Attached To
Mode
D15372: Convert Macro to PHUITwoColumnView
Attached
Detach File
Event Timeline
Log In to Comment