Skip to content

Commit

Permalink
Fix print preview, refs #8970
Browse files Browse the repository at this point in the history
- Move old print-preview rules to css/print-reports.css
- Create print-preview.css with the new rules added in arDominionPlugin
- Use print-reports.css in report pages
- Remove print-preview.css add and print preview bar in pages
  without print preview button
- Move to a partial and rename to 'Print preview' the print button
- Move print preview bar to a partial, hide it in real print view
  and style it in arDominionPlugin
  • Loading branch information
jraddaoui committed Sep 24, 2015
1 parent ed7c611 commit 0eedf4e
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 74 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php if ('print' == $sf_request->getParameter('media')): ?>
<div id="preview-message">
<?php echo __('Print preview') ?>
<?php echo link_to(__('Close'), array($resource, 'module' => 'informationobject')) ?>
<?php echo link_to(__('Close'), array_diff($sf_data->getRaw('sf_request')->getParameterHolder()->getAll(), array('media' => 'print'))) ?>
</div>
<?php endif; ?>
4 changes: 4 additions & 0 deletions apps/qubit/modules/default/templates/_printPreviewButton.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<a <?php echo isset($class) ? 'class="'. $class . '"' : '' ?> href="<?php echo url_for(array_merge($sf_data->getRaw('sf_request')->getParameterHolder()->getAll(), array('media' => 'print'))) ?>">
<i class="icon-print"></i>
<?php echo __('Print preview') ?>
</a>
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ public function execute($request)
$this->getResponse()->addJavascript('/vendor/jstree/jstree.min.js', 'last');
}

if ('print' == $request->getGetParameter('media', 'screen'))
{
$this->getResponse()->addStylesheet('print-preview', 'last');
}

$scopeAndContent = $this->resource->getScopeAndContent(array('cultureFallback' => true));
if (!empty($scopeAndContent))
{
Expand Down
6 changes: 3 additions & 3 deletions apps/qubit/modules/informationobject/config/view.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ multiFileUploadSuccess:

storageLocationsSuccess:
stylesheets:
print-preview: { media: screen, position: last }
print-reports: { media: screen, position: last }

fileListSuccess:
stylesheets:
print-preview: { media: screen, position: last }
print-reports: { media: screen, position: last }

itemListSuccess:
stylesheets:
print-preview: { media: screen, position: last }
print-reports: { media: screen, position: last }

renameSuccess:
javascripts:
Expand Down
2 changes: 1 addition & 1 deletion apps/qubit/modules/physicalobject/config/view.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
boxListSuccess:
stylesheets:
print-preview: { media: screen, position: last }
print-reports: { media: screen, position: last }
javascripts:
/plugins/sfDrupalPlugin/vendor/drupal/misc/jquery.once.js:
/plugins/sfDrupalPlugin/vendor/drupal/misc/tableheader:
Expand Down
5 changes: 0 additions & 5 deletions apps/qubit/modules/search/actions/indexAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ public function execute($request)
{
parent::execute($request);

if ('print' == $request->getGetParameter('media'))
{
$this->getResponse()->addStylesheet('print-preview', 'last');
}

// Print noResults template if query is empty
if (empty($request->query))
{
Expand Down
12 changes: 2 additions & 10 deletions apps/qubit/modules/search/templates/advancedSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@
<?php end_slot() ?>

<?php slot('title') ?>
<?php if ('print' == $sf_request->getParameter('media')): ?>
<div id="preview-message">
<?php echo __('Print preview') ?>
<?php echo link_to('Close', array_diff($sf_data->getRaw('sf_request')->getParameterHolder()->getAll(), array('media' => 'print'))) ?>
</div>
<?php endif; ?>
<?php echo get_partial('default/printPreviewBar') ?>

<h1><?php echo __('Advanced search') ?></h1>
<?php end_slot() ?>
Expand All @@ -78,10 +73,7 @@
<section id="action-icons">
<ul>
<li>
<a href="<?php echo url_for(array_merge($sf_data->getRaw('sf_request')->getParameterHolder()->getAll(), array('media' => 'print'))) ?>">
<i class="icon-print"></i>
<?php echo __('Print') ?>
</a>
<?php echo get_partial('default/printPreviewButton') ?>
</li>
<?php if (isset($pager) && $pager->hasResults() && $sf_user->isAuthenticated()): ?>
<li>
Expand Down
5 changes: 5 additions & 0 deletions apps/qubit/modules/user/actions/clipboardAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class UserClipboardAction extends DefaultBrowseAction

public function execute($request)
{
if ('print' == $request->getGetParameter('media'))
{
$this->getResponse()->addStylesheet('print-preview', 'last');
}

$slugs = $this->context->user->getClipboard()->getAll();

if (count($slugs) == 0)
Expand Down
7 changes: 3 additions & 4 deletions apps/qubit/modules/user/templates/clipboardSuccess.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php decorate_with('layout_1col') ?>

<?php slot('title') ?>
<?php echo get_partial('default/printPreviewBar') ?>

<div class="multiline-header">
<?php echo image_tag('/images/icons-large/icon-archival.png', array('alt' => '')) ?>
<h1 aria-describedby="results-label"><?php echo __('Showing %1% results', array('%1%' => $pager->getNbResults())) ?></h1>
Expand All @@ -10,10 +12,7 @@

<?php slot('before-content') ?>
<section class="header-options">
<a class="clipboard-print" href="<?php echo url_for(array_merge($sf_data->getRaw('sf_request')->getParameterHolder()->getAll(), array('media' => 'print'))) ?>">
<i class="icon-print"></i>
<?php echo __('Print') ?>
</a>
<?php echo get_partial('default/printPreviewButton', array('class' => 'clipboard-print')) ?>

<?php echo get_partial('default/sortPicker',
array(
Expand Down
7 changes: 0 additions & 7 deletions css/print-ie.css

This file was deleted.

28 changes: 2 additions & 26 deletions css/print-preview.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions css/print.css → css/print-reports.css
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,28 @@ table.item-list img
float: left;
margin: 2px 4px;
}

#print-date
{
display: none;
}

#preview-message
{
background: #eee;
display: block;
padding: 5px;
text-align: center;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}

#preview-message a
{
float: right;
}

#sfWebDebug
{
display: block;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<h1><?php echo render_title($dacs) ?></h1>

<?php echo get_partial('informationobject/printPreviewBar', array('resource' => $resource)) ?>

<?php if (isset($errorSchema)): ?>
<div class="messages error">
<ul>
Expand Down
10 changes: 9 additions & 1 deletion plugins/arDominionPlugin/css/less/print.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#context-menu,
section.actions,
footer,
#sfWebDebug
#sfWebDebug,
button.clipboard,
a.clipboard-print
{
display: none;
}
Expand Down Expand Up @@ -84,4 +86,10 @@
margin-top: 2px;
}

/* This must not be added to the minified CSS version in 'css/print-preview.css' */

#preview-message {
display: none;
}

}
14 changes: 14 additions & 0 deletions plugins/arDominionPlugin/css/less/scaffolding.less
Original file line number Diff line number Diff line change
Expand Up @@ -1756,3 +1756,17 @@ body.login #content {
border: 1px dashed #FFD700;
}

// Print preview bar

#preview-message {
background: #eee;
display: block;
padding: 5px;
text-align: center;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;

a {
float: right;
}
}
4 changes: 3 additions & 1 deletion plugins/arDominionPlugin/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
@import "less/header.less";
@import "less/treeview.less";
@import "less/popovers.less";
@import "less/print.less";
@import "less/description.less";
@import "less/import.less";
@import "less/forms.less";
Expand All @@ -67,6 +66,9 @@
@import "less/jobs.less";
@import "less/bootstrap-mod.less";

// Print rules last
@import "less/print.less";

// TODO
// Merge css/* (including classic)
// Use html.js if possible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<h1><?php echo render_title($dc) ?></h1>

<?php echo get_partial('informationobject/printPreviewBar', array('resource' => $resource)) ?>

<?php if (isset($errorSchema)): ?>
<div class="messages error">
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<h1><?php echo render_title($isad) ?></h1>

<?php echo get_partial('informationobject/printPreviewBar', array('resource' => $resource)) ?>

<?php if (isset($errorSchema)): ?>
<div class="messages error">
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<h1><?php echo render_title($mods) ?></h1>

<?php echo get_partial('informationobject/printPreviewBar', array('resource' => $resource)) ?>

<?php if (isset($errorSchema)): ?>
<div class="messages error">
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<h1><?php echo render_title($rad) ?></h1>

<?php echo get_partial('informationobject/printPreviewBar', array('resource' => $resource)) ?>

<?php if (isset($errorSchema)): ?>
<div class="messages error">
<ul>
Expand Down

0 comments on commit 0eedf4e

Please sign in to comment.