Merge lp:~methanal-developers/methanal/802284-printable-modal-dialog into lp:methanal

Proposed by Jonathan Jacobs
Status: Merged
Approved by: Tristan Seligmann
Approved revision: 177
Merged at revision: 174
Proposed branch: lp:~methanal-developers/methanal/802284-printable-modal-dialog
Merge into: lp:methanal
Diff against target: 109 lines (+59/-1)
3 files modified
methanal/js/Methanal/Widgets.js (+11/-1)
methanal/static/styles/methanal-ie.css (+12/-0)
methanal/static/styles/methanal.css (+36/-0)
To merge this branch: bzr merge lp:~methanal-developers/methanal/802284-printable-modal-dialog
Reviewer Review Type Date Requested Status
Tristan Seligmann Approve
Review via email: mp+65918@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tristan Seligmann (mithrandi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'methanal/js/Methanal/Widgets.js'
2--- methanal/js/Methanal/Widgets.js 2011-03-14 11:21:02 +0000
3+++ methanal/js/Methanal/Widgets.js 2011-06-26 21:45:56 +0000
4@@ -1465,6 +1465,11 @@
5 var T = Methanal.Util.DOMBuilder(self.node.ownerDocument);
6 self._overlayNode = T('div', {'class': 'modal-dialog-overlay'});
7 self.node.parentNode.appendChild(self._overlayNode);
8+
9+ Methanal.Util.addElementClass(
10+ self.node.ownerDocument.body, 'printing');
11+ Methanal.Util.addElementClass(
12+ self.node, 'print-target');
13 },
14
15
16@@ -1472,6 +1477,11 @@
17 * Dismiss the dialog.
18 */
19 function close(self) {
20+ Methanal.Util.removeElementClass(
21+ self.node.ownerDocument.body, 'printing');
22+ Methanal.Util.removeElementClass(
23+ self.node, 'print-target');
24+
25 self.detach();
26 self.node.parentNode.removeChild(self.node);
27 self._overlayNode.parentNode.removeChild(self._overlayNode);
28@@ -1491,7 +1501,7 @@
29 Methanal.Widgets.ModalDialog.fromWidgetInfo = function fromWidgetInfo(widgetParent, widgetInfo) {
30 var d = widgetParent.addChildWidgetFromWidgetInfo(widgetInfo);
31 return d.addCallback(function (widget) {
32- widgetParent.node.appendChild(widget.node);
33+ widgetParent.node.ownerDocument.body.appendChild(widget.node);
34 Methanal.Util.nodeInserted(widget);
35 return widget;
36 });
37
38=== modified file 'methanal/static/styles/methanal-ie.css'
39--- methanal/static/styles/methanal-ie.css 2010-12-17 09:18:55 +0000
40+++ methanal/static/styles/methanal-ie.css 2011-06-26 21:45:56 +0000
41@@ -54,3 +54,15 @@
42 .dependancy-parent {
43 background-position: 3px center;
44 }
45+
46+@media print {
47+ .print-target .modal-dialog-middle {
48+ top: 0;
49+ }
50+
51+ .print-target .modal-dialog-inner {
52+ /* 100% clips on the edges. */
53+ width: 99%;
54+ border: none;
55+ }
56+}
57
58=== modified file 'methanal/static/styles/methanal.css'
59--- methanal/static/styles/methanal.css 2011-03-16 12:58:08 +0000
60+++ methanal/static/styles/methanal.css 2011-06-26 21:45:56 +0000
61@@ -368,8 +368,10 @@
62 margin: 5% auto;
63 background: white;
64 padding: 1em;
65+ border-radius: 4px;
66 -moz-border-radius: 4px;
67 -webkit-border-radius: 4px;
68+ box-shadow: 0 0 30px #333;
69 -moz-box-shadow: 0 0 30px #333;
70 -webkit-box-shadow: 0 0 30px #333;
71 }
72@@ -566,3 +568,37 @@
73 margin: 0.5em;
74 margin-top: 1em;
75 }
76+
77+@media print {
78+ body.printing > * {
79+ display: none;
80+ }
81+
82+ body.printing .print-target {
83+ display: block;
84+ position: absolute:
85+ left: 0;
86+ top: 0;
87+ font-size: 50%;
88+ }
89+
90+ .print-target .modal-dialog-middle {
91+ display: block;
92+ }
93+
94+ .print-target .modal-dialog-inner {
95+ display: block;
96+ max-width: 100%;
97+ margin: auto;
98+ border-radius: 0;
99+ -moz-border-radius: 0;
100+ -webkit-border-radius: 0;
101+ box-shadow: none;
102+ -moz-box-shadow: none;
103+ -webkit-box-shadow: none;
104+ }
105+
106+ .print-target .no-print {
107+ display: none;
108+ }
109+}

Subscribers

People subscribed via source and target branches

to all changes: