From 7ebbe0fe71a6fff9876a8de795e82d5de1c82348 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 3 Sep 2015 10:03:50 -0700 Subject: [PATCH] Add a "Printable Version" link to Phortune invoices Summary: Ref T9309. This is a minor quality of life improvement, hopefully. We already have print CSS, just expose it more clearly. Also, hide actions (these never seem useful?) and footers from printable versions. I opened the printable version in a new window since it now doesn't have any actions. Test Plan: {F777241} {F777242} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9309 Differential Revision: https://secure.phabricator.com/D14045 --- resources/celerity/map.php | 10 +++++----- .../controller/PhortuneCartViewController.php | 8 ++++++++ src/view/layout/PhabricatorActionView.php | 17 +++++++++++++++++ .../css/application/base/standard-page-view.css | 4 ++++ .../rsrc/css/phui/phui-property-list-view.css | 4 ++++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c600d8d7bd..a076cf7814 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '928faf7e', + 'core.pkg.css' => '994de4ed', 'core.pkg.js' => '47dc9ebb', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '2de124c9', @@ -36,7 +36,7 @@ return array( 'rsrc/css/application/base/notification-menu.css' => 'f31c0bde', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '95351601', 'rsrc/css/application/base/phui-theme.css' => '6b451f24', - 'rsrc/css/application/base/standard-page-view.css' => '4d176b67', + 'rsrc/css/application/base/standard-page-view.css' => '1f53d056', 'rsrc/css/application/calendar/calendar-icon.css' => 'c69aa59f', 'rsrc/css/application/chatlog/chatlog.css' => 'd295b020', 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', @@ -141,7 +141,7 @@ return array( 'rsrc/css/phui/phui-object-item-list-view.css' => 'ab1bf393', 'rsrc/css/phui/phui-pager.css' => 'bea33d23', 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', - 'rsrc/css/phui/phui-property-list-view.css' => '15bbe0b0', + 'rsrc/css/phui/phui-property-list-view.css' => '318d4dea', 'rsrc/css/phui/phui-remarkup-preview.css' => '867f85b3', 'rsrc/css/phui/phui-spacing.css' => '042804d6', 'rsrc/css/phui/phui-status.css' => '888cedb8', @@ -743,7 +743,7 @@ return array( 'phabricator-side-menu-view-css' => 'bec2458e', 'phabricator-slowvote-css' => '475b4bd2', 'phabricator-source-code-view-css' => '5e0178de', - 'phabricator-standard-page-view' => '4d176b67', + 'phabricator-standard-page-view' => '1f53d056', 'phabricator-textareautils' => '5c93c52c', 'phabricator-title' => 'df5e11d2', 'phabricator-tooltip' => '1d298e3a', @@ -794,7 +794,7 @@ return array( 'phui-object-item-list-view-css' => 'ab1bf393', 'phui-pager-css' => 'bea33d23', 'phui-pinboard-view-css' => '2495140e', - 'phui-property-list-view-css' => '15bbe0b0', + 'phui-property-list-view-css' => '318d4dea', 'phui-remarkup-preview-css' => '867f85b3', 'phui-spacing-css' => '042804d6', 'phui-status-list-view-css' => '888cedb8', diff --git a/src/applications/phortune/controller/PhortuneCartViewController.php b/src/applications/phortune/controller/PhortuneCartViewController.php index f4eb0d9612..67f7c3df01 100644 --- a/src/applications/phortune/controller/PhortuneCartViewController.php +++ b/src/applications/phortune/controller/PhortuneCartViewController.php @@ -268,6 +268,7 @@ final class PhortuneCartViewController $refund_uri = $this->getApplicationURI("{$prefix}cart/{$id}/refund/"); $update_uri = $this->getApplicationURI("{$prefix}cart/{$id}/update/"); $accept_uri = $this->getApplicationURI("{$prefix}cart/{$id}/accept/"); + $print_uri = $this->getApplicationURI("{$prefix}cart/{$id}/?__print__=1"); $view->addAction( id(new PhabricatorActionView()) @@ -309,6 +310,13 @@ final class PhortuneCartViewController ->setHref($resume_uri)); } + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Printable Version')) + ->setHref($print_uri) + ->setOpenInNewWindow(true) + ->setIcon('fa-print')); + return $view; } diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index 43f84495c7..8c56f66968 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -14,6 +14,7 @@ final class PhabricatorActionView extends AphrontView { private $sigils = array(); private $metadata; private $selected; + private $openInNewWindow; public function setSelected($selected) { $this->selected = $selected; @@ -107,6 +108,15 @@ final class PhabricatorActionView extends AphrontView { return $this; } + public function setOpenInNewWindow($open_in_new_window) { + $this->openInNewWindow = $open_in_new_window; + return $this; + } + + public function getOpenInNewWindow() { + return $this->openInNewWindow; + } + public function render() { $icon = null; @@ -161,11 +171,18 @@ final class PhabricatorActionView extends AphrontView { ), $item); } else { + if ($this->getOpenInNewWindow()) { + $target = '_blank'; + } else { + $target = null; + } + $item = javelin_tag( 'a', array( 'href' => $this->getHref(), 'class' => 'phabricator-action-view-item', + 'target' => $target, 'sigil' => $sigils, 'meta' => $this->metadata, ), diff --git a/webroot/rsrc/css/application/base/standard-page-view.css b/webroot/rsrc/css/application/base/standard-page-view.css index 2d9b79dfea..3e24e597e3 100644 --- a/webroot/rsrc/css/application/base/standard-page-view.css +++ b/webroot/rsrc/css/application/base/standard-page-view.css @@ -25,6 +25,10 @@ color: {$greytext}; } +!print .phabricator-standard-page-footer { + display: none; +} + .device-desktop .has-local-nav + .phabricator-standard-page-footer { margin-left: 221px; } diff --git a/webroot/rsrc/css/phui/phui-property-list-view.css b/webroot/rsrc/css/phui/phui-property-list-view.css index 71a096e69e..e59906a6a3 100644 --- a/webroot/rsrc/css/phui/phui-property-list-view.css +++ b/webroot/rsrc/css/phui/phui-property-list-view.css @@ -176,6 +176,10 @@ border-left: 1px solid {$thinblueborder}; } +!print .phui-property-list-actions { + display: none; +} + .device .phui-property-list-actions { float: none; width: auto;