mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
Spiffy up PhamePostView
Summary: Cleaner Author information, less "Properties", Build a History Page. Ref T9897 Test Plan: Review New Posts, Draft Posts, View History {F1012934} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9897 Differential Revision: https://secure.phabricator.com/D14660
This commit is contained in:
parent
7ce2ad294f
commit
74882503aa
8 changed files with 107 additions and 32 deletions
|
@ -82,7 +82,7 @@ return array(
|
||||||
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
|
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
|
||||||
'rsrc/css/application/paste/paste.css' => 'b2f5a543',
|
'rsrc/css/application/paste/paste.css' => 'b2f5a543',
|
||||||
'rsrc/css/application/people/people-profile.css' => '25970776',
|
'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-edit.css' => '3ad9d1ee',
|
||||||
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
|
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
|
||||||
'rsrc/css/application/pholio/pholio.css' => '95174bdd',
|
'rsrc/css/application/pholio/pholio.css' => '95174bdd',
|
||||||
|
@ -776,7 +776,7 @@ return array(
|
||||||
'phabricator-uiexample-reactor-sendclass' => '1def2711',
|
'phabricator-uiexample-reactor-sendclass' => '1def2711',
|
||||||
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
|
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
|
||||||
'phabricator-zindex-css' => '57ddcaa2',
|
'phabricator-zindex-css' => '57ddcaa2',
|
||||||
'phame-css' => '46166309',
|
'phame-css' => 'cea3c9e1',
|
||||||
'pholio-css' => '95174bdd',
|
'pholio-css' => '95174bdd',
|
||||||
'pholio-edit-css' => '3ad9d1ee',
|
'pholio-edit-css' => '3ad9d1ee',
|
||||||
'pholio-inline-comments-css' => '8e545e49',
|
'pholio-inline-comments-css' => '8e545e49',
|
||||||
|
|
|
@ -3327,6 +3327,7 @@ phutil_register_library_map(array(
|
||||||
'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php',
|
'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php',
|
||||||
'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php',
|
'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php',
|
||||||
'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php',
|
'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php',
|
||||||
|
'PhamePostHistoryController' => 'applications/phame/controller/post/PhamePostHistoryController.php',
|
||||||
'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php',
|
'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php',
|
||||||
'PhamePostListView' => 'applications/phame/view/PhamePostListView.php',
|
'PhamePostListView' => 'applications/phame/view/PhamePostListView.php',
|
||||||
'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php',
|
'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php',
|
||||||
|
@ -7668,6 +7669,7 @@ phutil_register_library_map(array(
|
||||||
'PhamePostEditController' => 'PhamePostController',
|
'PhamePostEditController' => 'PhamePostController',
|
||||||
'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PhamePostFramedController' => 'PhamePostController',
|
'PhamePostFramedController' => 'PhamePostController',
|
||||||
|
'PhamePostHistoryController' => 'PhamePostController',
|
||||||
'PhamePostListController' => 'PhamePostController',
|
'PhamePostListController' => 'PhamePostController',
|
||||||
'PhamePostListView' => 'AphrontTagView',
|
'PhamePostListView' => 'AphrontTagView',
|
||||||
'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
|
|
|
@ -45,6 +45,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController',
|
||||||
'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController',
|
'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController',
|
||||||
'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController',
|
'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController',
|
||||||
|
'history/(?P<id>\d+)/' => 'PhamePostHistoryController',
|
||||||
'view/(?P<id>\d+)/' => 'PhamePostViewController',
|
'view/(?P<id>\d+)/' => 'PhamePostViewController',
|
||||||
'publish/(?P<id>\d+)/' => 'PhamePostPublishController',
|
'publish/(?P<id>\d+)/' => 'PhamePostPublishController',
|
||||||
'preview/(?P<id>\d+)/' => 'PhamePostPreviewController',
|
'preview/(?P<id>\d+)/' => 'PhamePostPreviewController',
|
||||||
|
|
|
@ -84,7 +84,7 @@ final class PhameBlogViewController extends PhameBlogController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$about = id(new PhameDescriptionView())
|
$about = id(new PhameDescriptionView())
|
||||||
->setTitle($blog->getName())
|
->setTitle(pht('About %s', $blog->getName()))
|
||||||
->setDescription($description)
|
->setDescription($description)
|
||||||
->setImage($blog->getProfileImageURI());
|
->setImage($blog->getProfileImageURI());
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -36,7 +36,6 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
$crumbs->setBorder(true);
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
$actions = $this->renderActions($post, $viewer);
|
$actions = $this->renderActions($post, $viewer);
|
||||||
$properties = $this->renderProperties($post, $viewer);
|
|
||||||
|
|
||||||
$action_button = id(new PHUIButtonView())
|
$action_button = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
|
@ -90,6 +89,33 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
),
|
),
|
||||||
$engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY)));
|
$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(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$post,
|
$post,
|
||||||
id(new PhamePostTransactionQuery())
|
id(new PhamePostTransactionQuery())
|
||||||
|
@ -99,6 +125,12 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
$add_comment = $this->buildCommentForm($post);
|
$add_comment = $this->buildCommentForm($post);
|
||||||
$add_comment = phutil_tag_div('mlb mlt', $add_comment);
|
$add_comment = phutil_tag_div('mlb mlt', $add_comment);
|
||||||
|
|
||||||
|
$properties = id(new PHUIPropertyListView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObject($post);
|
||||||
|
|
||||||
|
$properties->invokeWillRenderEvent();
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setTitle($post->getTitle())
|
->setTitle($post->getTitle())
|
||||||
->setPageObjectPHIDs(array($post->getPHID()))
|
->setPageObjectPHIDs(array($post->getPHID()))
|
||||||
|
@ -106,6 +138,7 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
->appendChild(
|
->appendChild(
|
||||||
array(
|
array(
|
||||||
$document,
|
$document,
|
||||||
|
$about,
|
||||||
$properties,
|
$properties,
|
||||||
$timeline,
|
$timeline,
|
||||||
$add_comment,
|
$add_comment,
|
||||||
|
@ -144,6 +177,12 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
->setDisabled(!$can_edit)
|
->setDisabled(!$can_edit)
|
||||||
->setWorkflow(!$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()) {
|
if ($post->isDraft()) {
|
||||||
$actions->addAction(
|
$actions->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
|
@ -190,33 +229,6 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
return $actions;
|
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) {
|
private function buildCommentForm(PhamePost $post) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ final class PhameDescriptionView extends AphrontTagView {
|
||||||
array(
|
array(
|
||||||
'class' => 'phame-blog-description-name',
|
'class' => 'phame-blog-description-name',
|
||||||
),
|
),
|
||||||
pht('About %s', $this->title));
|
$this->title);
|
||||||
|
|
||||||
return array($image, $header, $description);
|
return array($image, $header, $description);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,3 +29,8 @@
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phame-blog-description + .phui-property-list-section {
|
||||||
|
border-top: 1px solid rgba(71, 87, 120, 0.20);
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue