1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-14 16:51:08 +01:00

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
This commit is contained in:
epriestley 2015-09-03 10:03:50 -07:00
parent 28621244ad
commit 7ebbe0fe71
5 changed files with 38 additions and 5 deletions

View file

@ -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',

View file

@ -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;
}

View file

@ -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,
),

View file

@ -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;
}

View file

@ -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;