Page MenuHomePhabricator

D7363.id16578.diff
No OneTemporary

D7363.id16578.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -2497,11 +2497,7 @@
'DifferentialHunk' => 'DifferentialDAO',
'DifferentialHunkParserTestCase' => 'PhabricatorTestCase',
'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase',
- 'DifferentialInlineComment' =>
- array(
- 0 => 'DifferentialDAO',
- 1 => 'PhabricatorInlineCommentInterface',
- ),
+ 'DifferentialInlineComment' => 'PhabricatorInlineCommentInterface',
'DifferentialInlineCommentEditController' => 'PhabricatorInlineCommentController',
'DifferentialInlineCommentEditView' => 'AphrontView',
'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController',
Index: src/infrastructure/celerity/CelerityResourceTransformer.php
===================================================================
--- src/infrastructure/celerity/CelerityResourceTransformer.php
+++ src/infrastructure/celerity/CelerityResourceTransformer.php
@@ -39,6 +39,7 @@
switch ($type) {
case 'css':
+ $data = $this->replaceCSSPrintRules($path, $data);
$data = $this->replaceCSSVariables($path, $data);
$data = preg_replace_callback(
'@url\s*\((\s*[\'"]?.*?)\)@s',
@@ -129,6 +130,14 @@
$data);
}
+ private function replaceCSSPrintRules($path, $data) {
+ $this->currentPath = $path;
+ return preg_replace_callback(
+ '/!print\s+(.+?{.+?})/s',
+ array($this, 'replaceCSSPrintRule'),
+ $data);
+ }
+
public static function getCSSVariableMap() {
return array(
// Base Colors
@@ -174,6 +183,7 @@
);
}
+
public function replaceCSSVariable($matches) {
static $map;
if (!$map) {
@@ -190,4 +200,13 @@
return $map[$var_name];
}
+ public function replaceCSSPrintRule($matches) {
+ $rule = $matches[1];
+
+ $rules = array();
+ $rules[] = '.printable '.$rule;
+ $rules[] = "@media print {\n ".str_replace("\n", "\n ", $rule)."\n}\n";
+
+ return implode("\n\n", $rules);
+ }
}
Index: src/infrastructure/celerity/__tests__/transformer/print.css
===================================================================
--- /dev/null
+++ src/infrastructure/celerity/__tests__/transformer/print.css
@@ -0,0 +1,14 @@
+~~~~~~
+!print .example {
+ background: #ffffff;
+}
+~~~~~~
+.printable .example {
+ background: #ffffff;
+}
+
+@media print {
+ .example {
+ background: #ffffff;
+ }
+}
Index: src/view/page/PhabricatorStandardPageView.php
===================================================================
--- src/view/page/PhabricatorStandardPageView.php
+++ src/view/page/PhabricatorStandardPageView.php
@@ -424,6 +424,10 @@
$classes[] = 'platform-linux';
}
+ if ($this->getRequest()->getStr('__print__')) {
+ $classes[] = 'printable';
+ }
+
return implode(' ', $classes);
}
Index: webroot/rsrc/css/application/base/main-menu-view.css
===================================================================
--- webroot/rsrc/css/application/base/main-menu-view.css
+++ webroot/rsrc/css/application/base/main-menu-view.css
@@ -400,3 +400,11 @@
.phabricator-application-menu .phui-list-item-name {
padding-left: 12px;
}
+
+
+/* - Print ---------------------------------------------------------------------
+*/
+
+!print .phabricator-main-menu {
+ display: none;
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 25, 10:00 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8603504
Default Alt Text
D7363.id16578.diff (3 KB)

Event Timeline