From dbdc14e3766c12bf94704888b3b2a45e3d6f971f Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 12 Feb 2015 12:44:22 +0000 Subject: [PATCH] Special handling when printing for splitter --- etemplate/js/et2_widget_split.js | 26 ++++++++++++++++++++-- etemplate/templates/default/etemplate2.css | 13 +++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_split.js b/etemplate/js/et2_widget_split.js index c99c107138..3dc542b324 100644 --- a/etemplate/js/et2_widget_split.js +++ b/etemplate/js/et2_widget_split.js @@ -28,7 +28,7 @@ * @see http://methvin.com/splitter/ Uses Splitter * @augments et2_DOMWidget */ -var et2_split = et2_DOMWidget.extend([et2_IResizeable], +var et2_split = et2_DOMWidget.extend([et2_IResizeable,et2_IPrint], { attributes: { "orientation": { @@ -85,6 +85,9 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable], // Deferred object so we can wait for children this.loading = jQuery.Deferred(); + + // Flag to temporarily ignore resizing + this.stop_resize = false; }, destroy: function() { @@ -274,7 +277,7 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable], { this._init_splitter(); } - if(this.dynheight) + if(this.dynheight && !this.stop_resize ) { var old = {w: this.div.width(), h: this.div.height()}; this.dynheight.update(function(w,h) { @@ -376,6 +379,25 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable], */ toggleDock: function() { this.div.trigger("toggleDock"); + }, + + // Printing + /** + * Prepare for printing by stopping all the fuss + * + */ + beforePrint: function() { + // Resizing causes preference changes & relayouts. Don't do it. + this.stop_resize = true; + + // Add the class, if needed + this.div.addClass('print'); + + // Don't return anything, just work normally + }, + afterPrint: function() { + this.div.removeClass('print'); + this.stop_resize = false; } }); diff --git a/etemplate/templates/default/etemplate2.css b/etemplate/templates/default/etemplate2.css index 6a3a2870f3..53f03d20f3 100644 --- a/etemplate/templates/default/etemplate2.css +++ b/etemplate/templates/default/etemplate2.css @@ -131,6 +131,15 @@ div.et2_hbox > div { * > .et2_split { overflow: hidden; } +/* These need to be applied to tame the sizing before printing */ +.et2_split.print, .et2_split.print > .splitter-pane { + height: auto !important; + width: auto !important; +} +.et2_split.print > * { + position: relative !important; +} + /** * Label widget, and labels for other widgets */ @@ -1159,6 +1168,10 @@ div.message.floating { display: none; border:none; } + .et2_split, .et2_split > .splitter-pane { + height: auto !important; + width: auto !important; + } } /** * Grid / nextmatch Hierarchy