diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -83,7 +83,7 @@ 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 'rsrc/css/application/paste/paste.css' => '1898e534', 'rsrc/css/application/people/people-profile.css' => '2473d929', - 'rsrc/css/application/phame/phame.css' => 'aeb61182', + 'rsrc/css/application/phame/phame.css' => '0f847576', 'rsrc/css/application/pholio/pholio-edit.css' => '07676f51', 'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49', 'rsrc/css/application/pholio/pholio.css' => 'ca89d380', @@ -827,7 +827,7 @@ 'phabricator-uiexample-reactor-sendclass' => '1def2711', 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 'phabricator-zindex-css' => 'd1270942', - 'phame-css' => 'aeb61182', + 'phame-css' => '0f847576', 'pholio-css' => 'ca89d380', 'pholio-edit-css' => '07676f51', 'pholio-inline-comments-css' => '8e545e49', 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 @@ -162,6 +162,7 @@ $document->setFoot($next_view); $crumbs = $this->buildApplicationCrumbs(); $properties = phutil_tag_div('phui-document-view-pro-box', $properties); + $share = $this->buildSocialShare($post, $is_live); $page = $this->newPage() ->setTitle($post->getTitle()) @@ -171,6 +172,7 @@ array( $hero, $document, + $share, $about, $properties, $timeline, @@ -317,8 +319,7 @@ return array(head($prev), head($next)); } - private function buildPhamePostHeader( - PhamePost $post) { + private function buildPhamePostHeader(PhamePost $post) { $image = null; if ($post->getHeaderImagePHID()) { @@ -346,4 +347,43 @@ } + private function buildSocialShare(PhamePost $post, $is_live) { + if (!$is_live) { + return null; + } + Javelin::initBehavior('phabricator-tooltips'); + + $text = $post->getTitle(); + $url = $post->getLiveURI(); + + $twitter_href = "http://twitter.com/share?text={$text}&url={$url}"; + $facebook_href = "http://www.facebook.com/sharer/sharer.php?u={$url}"; + + $twitter = id(new PHUIIconCircleView()) + ->setIcon('fa-twitter') + ->setHref($twitter_href) + ->setSize(PHUIIconCircleView::MEDIUM) + ->addSigil('has-tooltip') + ->setMetadata( + array( + 'tip' => pht('Share on Twitter'), + 'align' => 'N', + 'size' => 212, + )); + + $facebook = id(new PHUIIconCircleView()) + ->setIcon('fa-facebook') + ->setHref($facebook_href) + ->setSize(PHUIIconCircleView::MEDIUM) + ->addSigil('has-tooltip') + ->setMetadata( + array( + 'tip' => pht('Share on Facebook'), + 'align' => 'N', + 'size' => 212, + )); + + return phutil_tag_div('phame-social-share', array($twitter, $facebook)); + } + } 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 @@ -2,13 +2,22 @@ * @provides phame-css */ -.phame-blog-description { +.phame-blog-description, +.phame-social-share { max-width: 800px; margin: 32px auto; position: relative; padding: 0 8px; } +.phame-social-share { + text-align: center; +} + +.phame-social-share .phui-icon-circle { + margin: 0 4px; +} + .phame-blog-description-name { font-weight: bold; font-size: {$biggerfontsize};