diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -126,7 +126,7 @@ 'rsrc/css/phui/phui-box.css' => 'a5bb366d', 'rsrc/css/phui/phui-button.css' => '16020a60', 'rsrc/css/phui/phui-crumbs-view.css' => 'd842f867', - 'rsrc/css/phui/phui-document-pro.css' => '61d70f8e', + 'rsrc/css/phui/phui-document-pro.css' => '4f2b42e3', 'rsrc/css/phui/phui-document.css' => '9fa715d2', 'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23', 'rsrc/css/phui/phui-fontkit.css' => 'c9d63950', @@ -781,7 +781,7 @@ 'phui-calendar-month-css' => '476be7e0', 'phui-crumbs-view-css' => 'd842f867', 'phui-document-view-css' => '9fa715d2', - 'phui-document-view-pro-css' => '61d70f8e', + 'phui-document-view-pro-css' => '4f2b42e3', 'phui-feed-story-css' => 'b7b26d23', 'phui-font-icon-base-css' => 'ecbbb4c2', 'phui-fontkit-css' => 'c9d63950', diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -3,12 +3,12 @@ final class PhamePostEditController extends PhameController { public function handleRequest(AphrontRequest $request) { - $user = $request->getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); if ($id) { $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( @@ -29,7 +29,7 @@ $v_projects = array_reverse($v_projects); } else { $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($request->getInt('blog'))) ->requireCapabilities( array( @@ -42,7 +42,7 @@ } $v_projects = array(); - $post = PhamePost::initializePost($user, $blog); + $post = PhamePost::initializePost($viewer, $blog); $cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/'); $submit_button = pht('Save Draft'); @@ -87,7 +87,7 @@ ->setNewValue(array('=' => array_fuse($v_projects))); $editor = id(new PhamePostEditor()) - ->setActor($user) + ->setActor($viewer) ->setContentSourceFromRequest($request) ->setContinueOnNoEffect(true); @@ -106,12 +106,12 @@ } $handle = id(new PhabricatorHandleQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withPHIDs(array($post->getBlogPHID())) ->executeOne(); $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->addHiddenInput('blog', $request->getInt('blog')) ->appendChild( id(new AphrontFormMarkupControl()) @@ -141,7 +141,7 @@ ->setValue($body) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ->setID('post-body') - ->setUser($user) + ->setUser($viewer) ->setDisableMacros(true)) ->appendControl( id(new AphrontFormTokenizerControl()) @@ -160,14 +160,18 @@ ->addCancelButton($cancel_uri) ->setValue($submit_button)); - $loading = phutil_tag_div( - 'aphront-panel-preview-loading-text', - pht('Loading preview...')); + $header = id(new PHUIHeaderView()) + ->setHeader(pht('%s (Post Preview)', $title)); - $preview_panel = phutil_tag_div('aphront-panel-preview', array( - phutil_tag_div('phame-post-preview-header', pht('Post Preview')), - phutil_tag('div', array('id' => 'post-preview'), $loading), - )); + $container = id(new PHUIBoxView()) + ->setID('post-preview'); + + $document = id(new PHUIDocumentViewPro()) + ->setHeader($header) + ->appendChild($container); + + $preview_panel = id(new PHUIObjectBoxView()) + ->appendChild($document); Javelin::initBehavior( 'phame-post-preview', @@ -189,14 +193,13 @@ $page_title, $this->getApplicationURI('/post/view/'.$id.'/')); - return $this->buildApplicationPage( - array( - $crumbs, - $form_box, - $preview_panel, - ), - array( - 'title' => $page_title, + return $this->newPage() + ->setTitle($page_title) + ->setCrumbs($crumbs) + ->appendChild( + array( + $form_box, + $preview_panel, )); } diff --git a/src/applications/phame/controller/post/PhamePostPreviewController.php b/src/applications/phame/controller/post/PhamePostPreviewController.php --- a/src/applications/phame/controller/post/PhamePostPreviewController.php +++ b/src/applications/phame/controller/post/PhamePostPreviewController.php @@ -6,10 +6,9 @@ return null; } - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); - $body = $request->getStr('body'); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $body = $request->getStr('body'); $post = id(new PhamePost()) ->setBody($body); @@ -17,7 +16,7 @@ $content = PhabricatorMarkupEngine::renderOneObject( $post, PhamePost::MARKUP_FIELD_BODY, - $user); + $viewer); $content = phutil_tag_div('phabricator-remarkup', $content); 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 @@ -3,10 +3,10 @@ final class PhamePostViewController extends PhameController { public function handleRequest(AphrontRequest $request) { - $user = $request->getUser(); + $viewer = $request->getViewer(); $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($request->getURIData('id'))) ->executeOne(); @@ -14,29 +14,35 @@ return new Aphront404Response(); } - $nav = $this->renderSideNavFilterView(); - - $actions = $this->renderActions($post, $user); - $properties = $this->renderProperties($post, $user, $actions); - $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb( $post->getTitle(), $this->getApplicationURI('post/view/'.$post->getID().'/')); + $crumbs->setBorder(true); - $nav->appendChild($crumbs); + $actions = $this->renderActions($post, $viewer); + $properties = $this->renderProperties($post, $viewer); + + $action_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Actions')) + ->setHref('#') + ->setIconFont('fa-bars') + ->addClass('phui-mobile-menu') + ->setDropdownMenu($actions); $header = id(new PHUIHeaderView()) - ->setHeader($post->getTitle()) - ->setUser($user) - ->setPolicyObject($post); + ->setHeader($post->getTitle()) + ->setUser($viewer) + ->setPolicyObject($post) + ->addActionLink($action_button); - $object_box = id(new PHUIObjectBoxView()) + $document = id(new PHUIDocumentViewPro()) ->setHeader($header) - ->addPropertyList($properties); + ->setPropertyList($properties); if ($post->isDraft()) { - $object_box->appendChild( + $document->appendChild( id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setTitle(pht('Draft Post')) @@ -47,7 +53,7 @@ } if (!$post->getBlog()) { - $object_box->appendChild( + $document->appendChild( id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_WARNING) ->setTitle(pht('Not On A Blog')) @@ -57,32 +63,40 @@ 'been deleted). Use "Move Post" to move it to a new blog.'))); } - $nav->appendChild( - array( - $object_box, - $this->buildTransactionTimeline( - $post, - new PhamePostTransactionQuery()), - )); - - return $this->buildApplicationPage( - $nav, - array( - 'title' => $post->getTitle(), + $engine = id(new PhabricatorMarkupEngine()) + ->setViewer($viewer) + ->addObject($post, PhamePost::MARKUP_FIELD_BODY) + ->process(); + + $document->appendChild( + phutil_tag( + 'div', + array( + 'class' => 'phabricator-remarkup', + ), + $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY))); + + return $this->newPage() + ->setTitle($post->getTitle()) + ->addClass('pro-white-background') + ->setCrumbs($crumbs) + ->appendChild( + array( + $document, )); } private function renderActions( PhamePost $post, - PhabricatorUser $user) { + PhabricatorUser $viewer) { $actions = id(new PhabricatorActionListView()) ->setObject($post) ->setObjectURI($this->getRequest()->getRequestURI()) - ->setUser($user); + ->setUser($viewer); $can_edit = PhabricatorPolicyFilter::hasCapability( - $user, + $viewer, $post, PhabricatorPolicyCapability::CAN_EDIT); @@ -139,7 +153,7 @@ $actions->addAction( id(new PhabricatorActionView()) - ->setUser($user) + ->setUser($viewer) ->setIcon('fa-globe') ->setHref($live_uri) ->setName(pht('View Live')) @@ -151,43 +165,28 @@ private function renderProperties( PhamePost $post, - PhabricatorUser $user, - PhabricatorActionListView $actions) { + PhabricatorUser $viewer) { $properties = id(new PHUIPropertyListView()) - ->setUser($user) - ->setObject($post) - ->setActionList($actions); + ->setUser($viewer) + ->setObject($post); $properties->addProperty( pht('Blog'), - $user->renderHandle($post->getBlogPHID())); + $viewer->renderHandle($post->getBlogPHID())); $properties->addProperty( pht('Blogger'), - $user->renderHandle($post->getBloggerPHID())); + $viewer->renderHandle($post->getBloggerPHID())); $properties->addProperty( pht('Published'), $post->isDraft() ? pht('Draft') - : phabricator_datetime($post->getDatePublished(), $user)); - - $engine = id(new PhabricatorMarkupEngine()) - ->setViewer($user) - ->addObject($post, PhamePost::MARKUP_FIELD_BODY) - ->process(); + : phabricator_datetime($post->getDatePublished(), $viewer)); $properties->invokeWillRenderEvent(); - $properties->addTextContent( - phutil_tag( - 'div', - array( - 'class' => 'phabricator-remarkup', - ), - $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY))); - return $properties; } diff --git a/webroot/rsrc/css/phui/phui-document-pro.css b/webroot/rsrc/css/phui/phui-document-pro.css --- a/webroot/rsrc/css/phui/phui-document-pro.css +++ b/webroot/rsrc/css/phui/phui-document-pro.css @@ -3,7 +3,8 @@ */ .phui-document-view.phui-document-view-pro, -.phui-document-view-pro-box { +.phui-document-view-pro-box, +.phui-document-properties { max-width: 800px; padding: 0 16px; position: relative; @@ -11,15 +12,14 @@ } .phui-document-properties { - max-width: 800px; - padding: 0 16px; + max-width: 768px; background-color: {$lightgreybackground}; - margin: 0 auto; + margin: 16px auto; border-radius: 3px; } -.device-phone .phui-document-properties { - margin: 0 8px; +.device .phui-document-properties { + margin: 0 8px 16px; } .device-phone .phui-document-view.phui-document-view-pro {