From adfb512adc8ea53fa1ea6a98fc04ac69b9c2cf20 Mon Sep 17 00:00:00 2001 From: Mike Hagedon Date: Fri, 8 Nov 2013 12:42:34 -0700 Subject: [PATCH] Fix #36. The print-certificate style sheet was interfering with printing the single-page view. --- app/View/Layouts/public.ctp | 14 ++++++-------- app/webroot/css/print_certificate.css | 16 ++++++++-------- app/webroot/js/tutorials/view_single_page.js | 2 ++ app/webroot/js/tutorials/view_tutorial_only.js | 2 ++ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/View/Layouts/public.ctp b/app/View/Layouts/public.ctp index 86f4c3c..1bcfc94 100755 --- a/app/View/Layouts/public.ctp +++ b/app/View/Layouts/public.ctp @@ -51,14 +51,12 @@ action != 'print_view') { - echo $this->Html->css('print_certificate', 'stylesheet', - array('media' => 'print', 'id' => 'print-certificate')); - echo ""; - } + echo $this->Html->css('print_certificate', 'stylesheet', + array('media' => 'print', 'id' => 'print-certificate')); + echo ""; ?> diff --git a/app/webroot/css/print_certificate.css b/app/webroot/css/print_certificate.css index 37bc24a..5a67727 100644 --- a/app/webroot/css/print_certificate.css +++ b/app/webroot/css/print_certificate.css @@ -1,11 +1,11 @@ @import url("email_print.css"); /* * is dangerous! */ -* { +.print-certificate * { display: none; } -html, body, #email-print, #email-print h2, #email-print div, #email-print p { +.print-certificate body, #email-print, #email-print h2, #email-print div, #email-print p { display: block !important; } @@ -41,7 +41,7 @@ html, body, #email-print, #email-print h2, #email-print div, #email-print p { display: none !important; } -.ui-widget { +.print-certificate .ui-widget { background: none !important; left: 0 !important; top: 0 !important; @@ -50,20 +50,20 @@ html, body, #email-print, #email-print h2, #email-print div, #email-print p { font-family: inherit !important; } -.ui-dialog { +.print-certificate .ui-dialog { width: 90% !important; height: auto !important; } -.ui-dialog-buttonpane { +.print-certificate .ui-dialog-buttonpane { display: none !important; } -.ui-resizable-handle { +.print-certificate .ui-resizable-handle { display: none !important; } -.ui-dialog-titlebar { +.print-certificate .ui-dialog-titlebar { display: none !important; } @@ -71,7 +71,7 @@ html, body, #email-print, #email-print h2, #email-print div, #email-print p { height: 100% !important; } -* { /* I can't find the element that's causing ticket #165, but this fixes it. */ +.print-certificate * { /* I can't find the element that's causing ticket #165, but this fixes it. */ overflow: visible !important; } diff --git a/app/webroot/js/tutorials/view_single_page.js b/app/webroot/js/tutorials/view_single_page.js index 4374263..ad10ddf 100644 --- a/app/webroot/js/tutorials/view_single_page.js +++ b/app/webroot/js/tutorials/view_single_page.js @@ -65,6 +65,7 @@ $(document).ready(function() { this_element.dialog("close"); this_element.dialog("destroy"); this_element.remove(); + $('body').removeClass('print-certificate'); } }, width: 700, @@ -73,6 +74,7 @@ $(document).ready(function() { $('email-print').text(); } }); + $('body').addClass('print-certificate'); $('#email-print').dialog('open'); $('#email-print').closest('.ui-dialog').height('90%'); $('#email-print-wrapper').height($('#email-print').closest('.ui-dialog').height() - 200); diff --git a/app/webroot/js/tutorials/view_tutorial_only.js b/app/webroot/js/tutorials/view_tutorial_only.js index 09def48..95596bb 100644 --- a/app/webroot/js/tutorials/view_tutorial_only.js +++ b/app/webroot/js/tutorials/view_tutorial_only.js @@ -83,6 +83,7 @@ $(document).ready(function() { this_element.dialog("close"); this_element.dialog("destroy"); this_element.remove(); + parent.$('body').removeClass('print-certificate'); } }, width: 700, @@ -91,6 +92,7 @@ $(document).ready(function() { parent.$('email-print').text(); } }); + parent.$('body').addClass('print-certificate'); parent.$('#email-print').dialog('open'); parent.$('#email-print').closest('.ui-dialog').height('90%'); parent.$('#email-print-wrapper').height(parent.$('#email-print').closest('.ui-dialog').height() - 200);