Page MenuHomePhabricator

D14660.id35462.diff
No OneTemporary

D14660.id35462.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -82,7 +82,7 @@
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
'rsrc/css/application/paste/paste.css' => 'b2f5a543',
'rsrc/css/application/people/people-profile.css' => '25970776',
- 'rsrc/css/application/phame/phame.css' => '46166309',
+ 'rsrc/css/application/phame/phame.css' => 'cea3c9e1',
'rsrc/css/application/pholio/pholio-edit.css' => '3ad9d1ee',
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
'rsrc/css/application/pholio/pholio.css' => '95174bdd',
@@ -776,7 +776,7 @@
'phabricator-uiexample-reactor-sendclass' => '1def2711',
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
'phabricator-zindex-css' => '57ddcaa2',
- 'phame-css' => '46166309',
+ 'phame-css' => 'cea3c9e1',
'pholio-css' => '95174bdd',
'pholio-edit-css' => '3ad9d1ee',
'pholio-inline-comments-css' => '8e545e49',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3327,6 +3327,7 @@
'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php',
'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php',
'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php',
+ 'PhamePostHistoryController' => 'applications/phame/controller/post/PhamePostHistoryController.php',
'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php',
'PhamePostListView' => 'applications/phame/view/PhamePostListView.php',
'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php',
@@ -7668,6 +7669,7 @@
'PhamePostEditController' => 'PhamePostController',
'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor',
'PhamePostFramedController' => 'PhamePostController',
+ 'PhamePostHistoryController' => 'PhamePostController',
'PhamePostListController' => 'PhamePostController',
'PhamePostListView' => 'AphrontTagView',
'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver',
diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php
--- a/src/applications/phame/application/PhabricatorPhameApplication.php
+++ b/src/applications/phame/application/PhabricatorPhameApplication.php
@@ -45,6 +45,7 @@
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController',
'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController',
'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController',
+ 'history/(?P<id>\d+)/' => 'PhamePostHistoryController',
'view/(?P<id>\d+)/' => 'PhamePostViewController',
'publish/(?P<id>\d+)/' => 'PhamePostPublishController',
'preview/(?P<id>\d+)/' => 'PhamePostPreviewController',
diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php
--- a/src/applications/phame/controller/blog/PhameBlogViewController.php
+++ b/src/applications/phame/controller/blog/PhameBlogViewController.php
@@ -84,7 +84,7 @@
}
$about = id(new PhameDescriptionView())
- ->setTitle($blog->getName())
+ ->setTitle(pht('About %s', $blog->getName()))
->setDescription($description)
->setImage($blog->getProfileImageURI());
diff --git a/src/applications/phame/controller/post/PhamePostHistoryController.php b/src/applications/phame/controller/post/PhamePostHistoryController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phame/controller/post/PhamePostHistoryController.php
@@ -0,0 +1,55 @@
+<?php
+
+final class PhamePostHistoryController extends PhamePostController {
+
+ public function shouldAllowPublic() {
+ return true;
+ }
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+
+ $post = id(new PhamePostQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($request->getURIData('id')))
+ ->executeOne();
+
+ if (!$post) {
+ return new Aphront404Response();
+ }
+
+ $blog = $post->getBlog();
+
+ $crumbs = $this->buildApplicationCrumbs();
+ if ($blog) {
+ $crumbs->addTextCrumb(
+ $blog->getName(),
+ $this->getApplicationURI('blog/view/'.$blog->getID().'/'));
+ } else {
+ $crumbs->addTextCrumb(
+ pht('[No Blog]'),
+ null);
+ }
+ $crumbs->addTextCrumb(
+ $post->getTitle(),
+ $this->getApplicationURI('post/view/'.$post->getID().'/'));
+ $crumbs->addTextCrumb(pht('Post History'));
+ $crumbs->setBorder(true);
+
+ $timeline = $this->buildTransactionTimeline(
+ $post,
+ new PhamePostTransactionQuery());
+ $timeline->setShouldTerminate(true);
+
+ return $this->newPage()
+ ->setTitle($post->getTitle())
+ ->setPageObjectPHIDs(array($post->getPHID()))
+ ->setCrumbs($crumbs)
+ ->appendChild(
+ array(
+ $timeline,
+ ));
+ }
+
+
+}
diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php
--- a/src/applications/phame/controller/post/PhamePostViewController.php
+++ b/src/applications/phame/controller/post/PhamePostViewController.php
@@ -36,7 +36,6 @@
$crumbs->setBorder(true);
$actions = $this->renderActions($post, $viewer);
- $properties = $this->renderProperties($post, $viewer);
$action_button = id(new PHUIButtonView())
->setTag('a')
@@ -90,6 +89,33 @@
),
$engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY)));
+ $blogger = id(new PhabricatorPeopleQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($post->getBloggerPHID()))
+ ->needProfileImage(true)
+ ->executeOne();
+ $blogger_profile = $blogger->loadUserProfile();
+
+ $author = phutil_tag(
+ 'a',
+ array(
+ 'href' => '/p/'.$blogger->getUsername().'/',
+ ),
+ $blogger->getUsername());
+
+ $date = phabricator_datetime($post->getDatePublished(), $viewer);
+ if ($post->isDraft()) {
+ $subtitle = pht('Unpublished draft by %s.', $author);
+ } else {
+ $subtitle = pht('Written by %s on %s.', $author, $date);
+ }
+
+ $about = id(new PhameDescriptionView())
+ ->setTitle($subtitle)
+ ->setDescription($blogger_profile->getTitle())
+ ->setImage($blogger->getProfileImageURI())
+ ->setImageHref('/p/'.$blogger->getUsername());
+
$timeline = $this->buildTransactionTimeline(
$post,
id(new PhamePostTransactionQuery())
@@ -99,6 +125,12 @@
$add_comment = $this->buildCommentForm($post);
$add_comment = phutil_tag_div('mlb mlt', $add_comment);
+ $properties = id(new PHUIPropertyListView())
+ ->setUser($viewer)
+ ->setObject($post);
+
+ $properties->invokeWillRenderEvent();
+
return $this->newPage()
->setTitle($post->getTitle())
->setPageObjectPHIDs(array($post->getPHID()))
@@ -106,6 +138,7 @@
->appendChild(
array(
$document,
+ $about,
$properties,
$timeline,
$add_comment,
@@ -144,6 +177,12 @@
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-history')
+ ->setHref($this->getApplicationURI('post/history/'.$id.'/'))
+ ->setName(pht('View History')));
+
if ($post->isDraft()) {
$actions->addAction(
id(new PhabricatorActionView())
@@ -190,33 +229,6 @@
return $actions;
}
- private function renderProperties(
- PhamePost $post,
- PhabricatorUser $viewer) {
-
- $properties = id(new PHUIPropertyListView())
- ->setUser($viewer)
- ->setObject($post);
-
- $properties->addProperty(
- pht('Blog'),
- $viewer->renderHandle($post->getBlogPHID()));
-
- $properties->addProperty(
- pht('Blogger'),
- $viewer->renderHandle($post->getBloggerPHID()));
-
- $properties->addProperty(
- pht('Published'),
- $post->isDraft()
- ? pht('Draft')
- : phabricator_datetime($post->getDatePublished(), $viewer));
-
- $properties->invokeWillRenderEvent();
-
- return $properties;
- }
-
private function buildCommentForm(PhamePost $post) {
$viewer = $this->getViewer();
diff --git a/src/applications/phame/view/PhameDescriptionView.php b/src/applications/phame/view/PhameDescriptionView.php
--- a/src/applications/phame/view/PhameDescriptionView.php
+++ b/src/applications/phame/view/PhameDescriptionView.php
@@ -52,7 +52,7 @@
array(
'class' => 'phame-blog-description-name',
),
- pht('About %s', $this->title));
+ $this->title);
return array($image, $header, $description);
}
diff --git a/webroot/rsrc/css/application/phame/phame.css b/webroot/rsrc/css/application/phame/phame.css
--- a/webroot/rsrc/css/application/phame/phame.css
+++ b/webroot/rsrc/css/application/phame/phame.css
@@ -29,3 +29,8 @@
border-radius: 3px;
position: absolute;
}
+
+.phame-blog-description + .phui-property-list-section {
+ border-top: 1px solid rgba(71, 87, 120, 0.20);
+ padding-top: 16px;
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 6, 4:24 PM (3 h, 42 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7286507
Default Alt Text
D14660.id35462.diff (9 KB)

Event Timeline