Merge lp:~unifield-team/unifield-web/web_bigger_popup into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4631
Proposed branch: lp:~unifield-team/unifield-web/web_bigger_popup
Merge into: lp:unifield-web
Diff against target: 726 lines (+627/-12)
8 files modified
addons/openerp/static/javascript/m2m.js (+2/-4)
addons/openerp/static/javascript/m2o.js (+2/-2)
addons/openerp/static/javascript/o2m.js (+2/-3)
addons/openerp/static/javascript/openerp/openerp.base.js (+2/-1)
openobject/controllers/templates/base.mako (+1/-0)
openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css (+2/-2)
openobject/static/javascript/jQuery/jquery.dialogextend.js (+611/-0)
openobject/static/javascript/openobject/openobject.dom.js (+5/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-web/web_bigger_popup
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+99016@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/m2m.js'
2--- addons/openerp/static/javascript/m2m.js 2011-01-17 11:57:11 +0000
3+++ addons/openerp/static/javascript/m2m.js 2012-03-23 13:05:29 +0000
4@@ -183,10 +183,8 @@
5 'source-window': $this[0],
6 source_id: options.source || null
7 }, {
8- width: '70%',
9- max_width: 1000,
10- height: '90%',
11- max_height: 700
12+ width: '90%',
13+ height: '95%'
14 });
15 }
16
17
18=== modified file 'addons/openerp/static/javascript/m2o.js'
19--- addons/openerp/static/javascript/m2o.js 2011-08-16 11:46:19 +0000
20+++ addons/openerp/static/javascript/m2o.js 2012-03-23 13:05:29 +0000
21@@ -601,9 +601,9 @@
22 'source-window': $this[0],
23 source_id: options.source || null
24 }, {
25- width: '80%',
26+ width: '90%',
27 max_width: 1200,
28- height: '90%'
29+ height: '95%'
30 });
31 }
32
33
34=== modified file 'addons/openerp/static/javascript/o2m.js'
35--- addons/openerp/static/javascript/o2m.js 2011-08-23 16:21:49 +0000
36+++ addons/openerp/static/javascript/o2m.js 2012-03-23 13:05:29 +0000
37@@ -243,9 +243,8 @@
38 }, {'source-window': $this[0],
39 'list': options['_terp_o2m']
40 }, {
41- width: '70%',
42- height: '90%',
43- max_height: 700
44+ width: '90%',
45+ height: '95%',
46 });
47 var $form = jQuery('<form>', {
48 method: 'POST',
49
50=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
51--- addons/openerp/static/javascript/openerp/openerp.base.js 2012-03-16 15:01:42 +0000
52+++ addons/openerp/static/javascript/openerp/openerp.base.js 2012-03-23 13:05:29 +0000
53@@ -176,7 +176,8 @@
54 src: action_url,
55 'class': 'action-dialog'
56 }, null, {
57- width: 800
58+ width: '90%',
59+ height: '95%'
60 });
61 break;
62 case 'download':
63
64=== modified file 'openobject/controllers/templates/base.mako'
65--- openobject/controllers/templates/base.mako 2010-12-14 17:34:23 +0000
66+++ openobject/controllers/templates/base.mako 2012-03-23 13:05:29 +0000
67@@ -20,6 +20,7 @@
68 <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.form.js"></script>
69 <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.ba-hashchange.js"></script>
70 <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js"></script>
71+ <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.dialogextend.js"></script>
72
73 <script type="text/javascript">
74 jQuery.noConflict();
75
76=== modified file 'openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css'
77--- openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css 2010-11-10 11:45:00 +0000
78+++ openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css 2012-03-23 13:05:29 +0000
79@@ -56,7 +56,7 @@
80
81 /* Component containers
82 ----------------------------------*/
83-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
84+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 0.7em; }
85 .ui-widget .ui-widget { font-size: 1em; }
86 .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
87 .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
88@@ -569,4 +569,4 @@
89 * http://docs.jquery.com/UI/Progressbar#theming
90 */
91 .ui-progressbar { height:2em; text-align: left; }
92-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
93\ No newline at end of file
94+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
95
96=== added file 'openobject/static/javascript/jQuery/jquery.dialogextend.js'
97--- openobject/static/javascript/jQuery/jquery.dialogextend.js 1970-01-01 00:00:00 +0000
98+++ openobject/static/javascript/jQuery/jquery.dialogextend.js 2012-03-23 13:05:29 +0000
99@@ -0,0 +1,611 @@
100+/*!
101+ * jQuery DialogExtend 1.0
102+ *
103+ * Copyright (c) 2010 Shum Ting Hin
104+ *
105+ * Licensed under MIT
106+ * http://www.opensource.org/licenses/mit-license.php
107+ *
108+ * Project Home:
109+ * http://code.google.com/p/jquery-dialogextend/
110+ *
111+ * Depends:
112+ * jQuery 1.4
113+ * jQuery UI Dialog 1.8.0
114+ *
115+ * History:
116+ * 0.9 / 2010-11-04 / hin / creation of plugin
117+ * 0.9.1 / 2010-11-16 / hin / fix bug of zero-config
118+ * 0.9.2 / 2010-12-16 / hin / fix bug of not firing <load.dialogExtend> event
119+ * apply <events> as init option for defining event-callback
120+ * 1.0 / 2010-01-05 / hin / fix bug of button-pane in 'minimized' state
121+ * fix bug of title-bar word-wrap in 'minimized' state
122+ * apply <titlebar=none|transparent> as init option for enhancing title-bar feature
123+ * apply <dblclick=collapse> as init option for enhancing double-click feature
124+ *
125+ */
126+(function($){
127+
128+ //default settings
129+ var defaults = {
130+ "maximize" : false,
131+ "minimize" : false,
132+ "collapse" : false,
133+ "dblclick" : false,
134+ "titlebar" : false,
135+ "icons" : {
136+ "maximize" : "ui-icon-extlink",
137+ "minimize" : "ui-icon-minus",
138+ "restore" : "ui-icon-newwin",
139+ "collapse": "ui-icon-carat-1-n",
140+ "uncollapse": "ui-icon-carat-1-s",
141+ },
142+ "events" : {
143+ "load" : null,
144+ "beforeCollapse" : null,
145+ "beforeMaximize" : null,
146+ "beforeMinimize" : null,
147+ "beforeRestore" : null,
148+ "collapse" : null,
149+ "maximize" : null,
150+ "minimize" : null,
151+ "restore" : null
152+ }
153+ };
154+
155+ //plugin settings (will be modified during init)
156+ var settings;
157+
158+ //plubic methods
159+ var methods = {
160+
161+ "init" : function( options ){
162+ var self = this;
163+ //validation
164+ if ( !$(self).dialog ) {
165+ $.error( "jQuery.dialogExtend Error : Only jQuery UI Dialog element is accepted" );
166+ }
167+ //merge defaults & options, without modifying the defaults
168+ options = options || {};
169+ options.icons = options.icons || {};
170+ options.events = options.events || {};
171+ settings = $.extend({}, defaults, options);
172+ settings.icons = $.extend({}, defaults.icons, options.icons);
173+ settings.events = $.extend({}, defaults.events, options.events);
174+ //initiate plugin...
175+ $(self).each(function(){
176+ $(this)
177+ //set default dialog state
178+ .data("dialog-state", "normal")
179+ //do bunch of things...
180+ .dialogExtend("_verifySettings")
181+ .dialogExtend("_initEvents")
182+ .dialogExtend("_initStyles")
183+ .dialogExtend("_initButtons")
184+ .dialogExtend("_initTitleBar")
185+ //trigger custom event when done
186+ .dialogExtend("_trigger", "load");
187+ });
188+ //maintain chainability
189+ return self;
190+ },
191+
192+ "collapse" : function(){
193+ var self = this;
194+ //calculate new dimension
195+ var newHeight = $(this).dialog("widget").find(".ui-dialog-titlebar").height()+15;
196+ //start!
197+ $(self)
198+ //trigger custom event
199+ .dialogExtend("_trigger", "beforeCollapse")
200+ //remember original state
201+ .dialogExtend("_saveSnapshot")
202+ //mark new state
203+ .data("dialog-state", "collapsed")
204+ //modify dialog size (after hiding content)
205+ .dialog("option", {
206+ "height" : newHeight,
207+ "maxHeight" : newHeight
208+ })
209+ //hide content
210+ //hide button-pane
211+ //make title-bar no-wrap
212+ .hide()
213+ .dialog("widget")
214+ .find(".ui-dialog-buttonpane:visible").hide().end()
215+ .find(".ui-dialog-titlebar").css("white-space", "nowrap").end()
216+ .find("#ui-dialog-collapse-button").addClass(settings.icons.uncollapse).removeClass(settings.icons.collapse).end()
217+ .find(".ui-dialog-content")
218+ //trigger custom event
219+ .dialogExtend("_trigger", "collapse");
220+ //maintain chainability
221+ return self;
222+ },
223+
224+ "maximize" : function(){
225+ var self = this;
226+ //caculate new dimension
227+ var newHeight = $(window).height()-11;
228+ var newWidth = $(window).width()-11;
229+ //start!
230+ $(self)
231+ //trigger custom event
232+ .dialogExtend("_trigger", "beforeMaximize")
233+ //remember original state
234+ .dialogExtend("_saveSnapshot")
235+ //mark new state
236+ .data("dialog-state", "maximized")
237+ //modify dialog button
238+ .dialogExtend("_toggleButtons")
239+ //fix dialog from scrolling
240+ .dialog("widget")
241+ .css("position", "fixed")
242+ .find(".ui-dialog-content")
243+ //show content
244+ //show button-pane (when minimized/collapsed)
245+ .show()
246+ .dialog("widget")
247+ .find(".ui-dialog-buttonpane").show().end()
248+ .find(".ui-dialog-content")
249+ //modify dialog with new config
250+ .dialog("option", {
251+ "resizable" : false,
252+ "draggable" : false,
253+ "height" : newHeight,
254+ "width" : newWidth,
255+ "position" : [1, 1]
256+ })
257+ //disable draggable-handle (for <titlebar=none> only)
258+ .dialog("widget")
259+ .draggable("option", "handle", null)
260+ .find(".ui-dialog-draggable-handle").css("cursor", "text").end()
261+ .find(".ui-dialog-content")
262+ //trigger custom event
263+ .dialogExtend("_trigger", "maximize");
264+ //maintain chainability
265+ return self;
266+ },
267+
268+ "minimize" : function(){
269+ var self = this;
270+ var container = "#minimized-dialog-container";
271+ //caculate new dimension
272+ var newHeight = $(this).dialog("widget").find(".ui-dialog-titlebar").height()+15;
273+ var newWidth = 200;
274+ //create container for (multiple) minimized dialogs (when necessary)
275+ if ( !$(container).length ) {
276+ $("<div />")
277+ .attr("id", container.replace("#", ""))
278+ .css({ "left" : 1, "bottom" : 1, "position" : "fixed" })
279+ .appendTo("body");
280+ }
281+ //start!
282+ $(self)
283+ //trigger custom event
284+ .dialogExtend("_trigger", "beforeMinimize")
285+ //remember original state
286+ .dialogExtend("_saveSnapshot")
287+ //mark new state
288+ .data("dialog-state", "minimized")
289+ //modify dialog button
290+ .dialogExtend("_toggleButtons")
291+ //move dialog from body to container
292+ .dialog("widget")
293+ .css({
294+ "float" : "left", //float is essential for stacking
295+ "margin" : 1,
296+ "position" : "static"
297+ })
298+ .appendTo(container)
299+ .find(".ui-dialog-content")
300+ //modify dialog with new config
301+ .dialog("option", {
302+ "resizable" : false,
303+ "draggable" : false,
304+ "height" : newHeight,
305+ "width" : newWidth
306+ })
307+ //hide content
308+ //hide button-pane
309+ //make title-bar no-wrap
310+ .hide()
311+ .dialog("widget")
312+ .find(".ui-dialog-buttonpane:visible").hide().end()
313+ .find(".ui-dialog-titlebar").css("white-space", "nowrap").end()
314+ .find(".ui-dialog-content")
315+ //disable draggable-handle (for <titlebar=none> only)
316+ .dialog("widget")
317+ .draggable("option", "handle", null)
318+ .find(".ui-dialog-draggable-handle").css("cursor", "text").end()
319+ .find(".ui-dialog-content")
320+ //trigger custom event
321+ .dialogExtend("_trigger", "minimize");
322+ //maintain chainability
323+ return self;
324+ },
325+
326+ "restore" : function(){
327+ var self = this;
328+ var beforeState = $(self).data("dialog-state");
329+ //start!
330+ $(self)
331+ //trigger custom event
332+ .dialogExtend("_trigger", "beforeRestore")
333+ //mark new state
334+ .data("dialog-state", "normal")
335+ //restore dialog button
336+ .dialogExtend("_toggleButtons")
337+ //restore dialog according to previous state
338+ .dialogExtend(
339+ beforeState == "maximized" ? "_restoreFromMaximized" :
340+ beforeState == "minimized" ? "_restoreFromMinimized" :
341+ beforeState == "collapsed" ? "_restoreFromCollapsed" :
342+ $.error( "jQuery.dialogExtend Error : Cannot restore dialog from unknown state '" + beforeState +"'" )
343+ )
344+ //trigger custom event
345+ .dialogExtend("_trigger", "restore");
346+ //maintain chainability
347+ return self;
348+ },
349+
350+ "_initButtons" : function(){
351+ var self = this;
352+ //start operation on titlebar
353+ var titlebar = $(self).dialog("widget").find(".ui-dialog-titlebar");
354+ $(titlebar)
355+ .append('<a class="ui-dialog-titlebar-maximize ui-corner-all" href="#"><span class="ui-icon '+settings.icons.maximize+'">maximize</span></a>')
356+ .append('<a class="ui-dialog-titlebar-minimize ui-corner-all" href="#"><span class="ui-icon '+settings.icons.minimize+'">minimize</span></a>')
357+ .append('<a class="ui-dialog-titlebar-collapse ui-corner-all" href="#"><span id="ui-dialog-collapse-button" class="ui-icon '+settings.icons.collapse+'">collapse</span></a>')
358+ .append('<a class="ui-dialog-titlebar-restore ui-corner-all" href="#"><span class="ui-icon '+settings.icons.restore+'">restore</span></a>')
359+ //add effect to buttons
360+ .find(".ui-dialog-titlebar-maximize,.ui-dialog-titlebar-minimize,.ui-dialog-titlebar-collapse,.ui-dialog-titlebar-restore")
361+ .attr("role", "button")
362+ .mouseover(function(){ $(this).addClass("ui-state-hover"); })
363+ .mouseout(function(){ $(this).removeClass("ui-state-hover"); })
364+ .focus(function(){ $(this).addClass("ui-state-focus"); })
365+ .blur(function(){ $(this).removeClass("ui-state-focus"); })
366+ .end()
367+ //default show buttons
368+ //set button positions
369+ //on-click-button
370+ .find(".ui-dialog-titlebar-maximize")
371+ .toggle(settings.maximize)
372+ .css({ "right" : settings.maximize ? "2.4em" : "-9999em" })
373+ .click(function(e){
374+ e.preventDefault();
375+ $(self).dialogExtend("maximize");
376+ })
377+ .end()
378+ .find(".ui-dialog-titlebar-minimize")
379+ .toggle(settings.minimize)
380+ .css({ "right" : settings.maximize ? "4.6em" : settings.minimize ? "2.3em" : "-9999em" })
381+ .click(function(e){
382+ e.preventDefault();
383+ $(self).dialogExtend("minimize");
384+ })
385+ .end()
386+ .find(".ui-dialog-titlebar-collapse")
387+ .toggle(settings.collapse)
388+ .css({ "right" : settings.collapse ? (2.3*(1+ (settings.maximize?1:0) + (settings.minimize?1:0)))+"em" : "-9999em" })
389+ .click(function(e){
390+ e.preventDefault();
391+ if ($(self).data("dialog-state") == "collapsed") {
392+ $(self).dialogExtend("restore");
393+ } else {
394+ $(self).dialogExtend("collapse");
395+ }
396+ })
397+ .end()
398+ .find(".ui-dialog-titlebar-restore")
399+ .hide()
400+ .css({ "right" : "-9999em" })
401+ .click(function(e){
402+ e.preventDefault();
403+ $(self).dialogExtend("restore");
404+ })
405+ .end()
406+ //on-dblclick-titlebar : maximize/minimize/collapse/restore
407+ .dblclick(function(evt){
408+ if ( settings.dblclick && settings.dblclick.length ) {
409+ $(self).dialogExtend( $(self).data("dialog-state") != "normal" ? "restore" : settings.dblclick );
410+ }
411+ })
412+ //avoid text-highlight when double-click
413+ .each(function(){
414+ $(this)
415+ //.attr("unselectable", "on")
416+ //.css({ "-moz-user-select" : "none", "-khtml-user-select" : "none" })
417+ .select(function(){ return false; });
418+ });
419+ //maintain chainability
420+ return self;
421+ },
422+
423+ "_initEvents" : function(){
424+ var self = this;
425+ //bind event callbacks which specified at init
426+ $.each(settings.events, function(type){
427+ if ( $.isFunction( settings.events[type] ) ) {
428+ $(self).bind(type+".dialogExtend", settings.events[type]);
429+ }
430+ });
431+ //maintain chainability
432+ return self;
433+ },
434+
435+ "_initStyles" : function(){
436+ var self = this;
437+ //append styles for this plugin to body
438+ var style = '';
439+ style += '<style type="text/css">';
440+ style += '.ui-dialog .ui-dialog-titlebar-maximize,';
441+ style += '.ui-dialog .ui-dialog-titlebar-minimize,';
442+ style += '.ui-dialog .ui-dialog-titlebar-collapse,';
443+ style += '.ui-dialog .ui-dialog-titlebar-restore { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }';
444+ style += '.ui-dialog .ui-dialog-titlebar-maximize span,';
445+ style += '.ui-dialog .ui-dialog-titlebar-minimize span,';
446+ style += '.ui-dialog .ui-dialog-titlebar-restore span { display: block; margin: 1px; }';
447+ style += '.ui-dialog .ui-dialog-titlebar-maximize:hover,';
448+ style += '.ui-dialog .ui-dialog-titlebar-maximize:focus,';
449+ style += '.ui-dialog .ui-dialog-titlebar-minimize:hover,';
450+ style += '.ui-dialog .ui-dialog-titlebar-minimize:focus,';
451+ style += '.ui-dialog .ui-dialog-titlebar-restore:hover,';
452+ style += '.ui-dialog .ui-dialog-titlebar-restore:focus { padding: 0; }';
453+ style += '.ui-dialog .ui-dialog-titlebar ::selection { background-color: transparent; }';
454+ style += '</style>';
455+ $(style).appendTo("body");
456+ //maintain chainability
457+ return self;
458+ },
459+
460+ "_initTitleBar" : function(){
461+ var self = this;
462+ //modify title bar
463+ switch ( settings.titlebar ) {
464+ case false:
465+ //do nothing
466+ break;
467+ case "none":
468+ //create new draggable-handle as substitute of title bar
469+ if ( $(self).dialog("option", "draggable") ) {
470+ var handle = $("<div />").addClass("ui-dialog-draggable-handle").css("cursor", "move").height(5);
471+ $(self).dialog("widget").prepend(handle).draggable("option", "handle", handle);
472+ }
473+ //remove title bar and keep it draggable
474+ $(self)
475+ .dialog("widget")
476+ .find(".ui-dialog-titlebar")
477+ //clear title text
478+ .find(".ui-dialog-title").html("&nbsp;").end()
479+ //keep buttons at upper-right-hand corner
480+ .css({
481+ "background-color" : "transparent",
482+ "background-image" : "none",
483+ "border" : 0,
484+ "position" : "absolute",
485+ "right" : 0,
486+ "top" : 0,
487+ "z-index" : 9999
488+ })
489+ .end();
490+ break;
491+ case "transparent":
492+ //remove title style
493+ $(self)
494+ .dialog("widget")
495+ .find(".ui-dialog-titlebar")
496+ .css({
497+ "background-color" : "transparent",
498+ "background-image" : "none",
499+ "border" : 0
500+ });
501+ break;
502+ default:
503+ $.error( "jQuery.dialogExtend Error : Invalid <titlebar> value '" + settings.titlebar + "'" );
504+ }
505+ //maintain chainability
506+ return self;
507+ },
508+
509+ "_loadSnapshot" : function(){
510+ var self = this;
511+ return {
512+ "config" : {
513+ "resizable" : $(self).data("original-config-resizable"),
514+ "draggable" : $(self).data("original-config-draggable")
515+ },
516+ "size" : {
517+ "height" : $(self).data("original-size-height"),
518+ "width" : $(self).data("original-size-width"),
519+ "maxHeight" : $(self).data("original-size-maxHeight")
520+ },
521+ "position" : {
522+ "mode" : $(self).data("original-position-mode"),
523+ "left" : $(self).data("original-position-left"),
524+ "top" : $(self).data("original-position-top")
525+ },
526+ "titlebar" : {
527+ "wrap" : $(self).data("original-titlebar-wrap")
528+ }
529+ };
530+ },
531+
532+ "_restoreFromCollapsed" : function(){
533+ var self = this;
534+ var original = $(this).dialogExtend("_loadSnapshot");
535+ //restore dialog
536+ $(self)
537+ //show content
538+ //show button-pane
539+ //fix title-bar wrap
540+ .show()
541+ .dialog("widget")
542+ .find(".ui-dialog-buttonpane:hidden").show().end()
543+ .find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end()
544+ .find(".ui-dialog-content")
545+ //restore config & size
546+ .dialog("option", {
547+ "height" : original.size.height,
548+ "maxHeight" : original.size.maxHeight
549+ });
550+ //maintain chainability
551+ return self;
552+ },
553+
554+ "_restoreFromMaximized" : function(){
555+ var self = this;
556+ var original = $(this).dialogExtend("_loadSnapshot");
557+ //restore dialog
558+ $(self)
559+ //free dialog from scrolling
560+ //fix title-bar wrap (if dialog was minimized/collapsed)
561+ .dialog("widget")
562+ .css("position", original.position.mode)
563+ .find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end()
564+ .find(".ui-dialog-content")
565+ //restore config & size & position
566+ .dialog("option", {
567+ "resizable" : original.config.resizable,
568+ "draggable" : original.config.draggable,
569+ "height" : original.size.height,
570+ "width" : original.size.width,
571+ "maxHeight" : original.size.maxHeight,
572+ "position" : [ original.position.left, original.position.top ]
573+ })
574+ //restore draggable-handle (for <titlebar=none> only)
575+ .dialog("widget")
576+ .draggable("option", "handle", $(this).find(".ui-dialog-draggable-handle"))
577+ .find(".ui-dialog-draggable-handle")
578+ .css("cursor", "move");
579+ //maintain chainability
580+ return self;
581+ },
582+
583+ "_restoreFromMinimized" : function(){
584+ var self = this;
585+ var original = $(this).dialogExtend("_loadSnapshot");
586+ var container = "#minimized-dialog-container";
587+ //restore dialog
588+ $(self)
589+ //move dialog back from container to body
590+ .dialog("widget")
591+ .appendTo("body")
592+ .css({
593+ "float" : "none",
594+ "margin" : 0,
595+ "position" : original.position.mode
596+ })
597+ .find(".ui-dialog-content")
598+ //show content
599+ //show button-pane
600+ //fix title-bar wrap
601+ .show()
602+ .dialog("widget")
603+ .find(".ui-dialog-buttonpane:hidden").show().end()
604+ .find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end()
605+ .find(".ui-dialog-content")
606+ //restore config & size & position
607+ .dialog("option", {
608+ "resizable" : original.config.resizable,
609+ "draggable" : original.config.draggable,
610+ "height" : original.size.height,
611+ "width" : original.size.width,
612+ "maxHeight" : original.size.maxHeight,
613+ "position" : [ original.position.left, original.position.top ]
614+ })
615+ //restore draggable-handle (for <titlebar=none> only)
616+ .dialog("widget")
617+ .draggable("option", "handle", $(this).find(".ui-dialog-draggable-handle"))
618+ .find(".ui-dialog-draggable-handle")
619+ .css("cursor", "move");
620+ //maintain chainability
621+ return self;
622+ },
623+
624+ "_saveSnapshot" : function(){
625+ var self = this;
626+ //remember all configs under normal state
627+ if ( $(self).data("dialog-state") == "normal" ) {
628+ $(self)
629+ .data("original-config-resizable", $(self).dialog("option", "resizable"))
630+ .data("original-config-draggable", $(self).dialog("option", "draggable"))
631+ .data("original-size-height", $(self).dialog("widget").height())
632+ .data("original-size-width", $(self).dialog("option", "width"))
633+ .data("original-size-maxHeight", $(self).dialog("option", "maxHeight"))
634+ .data("original-position-mode", $(self).dialog("widget").css("position"))
635+ .data("original-position-left", $(self).dialog("widget").offset().left)
636+ .data("original-position-top", $(self).dialog("widget").offset().top)
637+ .data("original-titlebar-wrap", $(self).dialog("widget").find(".ui-dialog-titlebar").css("white-space"));
638+ }
639+ //maintain chainability
640+ return self;
641+ },
642+
643+ "_toggleButtons" : function(){
644+ var self = this;
645+ //show or hide buttons & decide position
646+ $(self).dialog("widget")
647+ .find(".ui-dialog-titlebar-maximize")
648+ .toggle( $(self).data("dialog-state") != "maximized" && settings.maximize )
649+ .end()
650+ .find(".ui-dialog-titlebar-minimize")
651+ .toggle( $(self).data("dialog-state") != "minimized" && settings.minimize )
652+ .end()
653+ .find(".ui-dialog-titlebar-restore")
654+ .toggle( $(self).data("dialog-state") != "normal" && ( settings.maximize || settings.minimize ) )
655+ .css({ "right" : $(self).data("dialog-state") == "maximized" ? "2.4em" : $(self).data("dialog-state") == "minimized" ? !settings.maximize ? "2.4em" : "4.6em" : "-9999em" })
656+ .end()
657+ .find("#ui-dialog-collapse-button")
658+ .addClass(settings.icons.collapse)
659+ .removeClass(settings.icons.uncollapse)
660+ .end();
661+ //maintain chainability
662+ return self;
663+ },
664+
665+ "_trigger" : function( type ){
666+ var self = this;
667+ //trigger event with namespace when user bind to it
668+ $(self).triggerHandler(type+".dialogExtend", this);
669+ //maintain chainability
670+ return self;
671+ },
672+
673+ "_verifySettings" : function(){
674+ var self = this;
675+ //check <dblclick> option
676+ if ( !settings.dblclick ) {
677+ } else if ( settings.dblclick == "maximize" ) {
678+ } else if ( settings.dblclick == "minimize" ) {
679+ } else if ( settings.dblclick == "collapse" ) {
680+ } else {
681+ $.error( "jQuery.dialogExtend Error : Invalid <dblclick> value '" + settings.dblclick + "'" );
682+ settings.dblclick = false;
683+ }
684+ //check <titlebar> option
685+ if ( !settings.titlebar ) {
686+ } else if ( settings.titlebar == "none" ) {
687+ } else if ( settings.titlebar == "transparent" ) {
688+ } else {
689+ $.error( "jQuery.dialogExtend Error : Invalid <titlebar> value '" + settings.titlebar + "'" );
690+ settings.titlebar = false;
691+ }
692+ //maintain chainability
693+ return self;
694+ }
695+
696+ };
697+
698+ //core method
699+ $.fn.dialogExtend = function( method ){
700+ //method calling logic
701+ if ( methods[ method ] ) {
702+ return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
703+ } else if ( typeof method === "object" || ! method ) {
704+ return methods.init.apply( this, arguments );
705+ } else {
706+ $.error( "jQuery.dialogExtend Error : Method <" + method + "> does not exist" );
707+ }
708+ };
709+
710+}(jQuery));
711
712=== modified file 'openobject/static/javascript/openobject/openobject.dom.js'
713--- openobject/static/javascript/openobject/openobject.dom.js 2011-04-08 09:24:41 +0000
714+++ openobject/static/javascript/openobject/openobject.dom.js 2012-03-23 13:05:29 +0000
715@@ -97,6 +97,11 @@
716 width: options.width,
717 height: options.height,
718 close: options.close
719+ })
720+ .dialogExtend({
721+ "dblclick" : "collapse",
722+ "collapse": true,
723+ "maximize": true,
724 });
725 $frame[0].set_title = function (title) {
726 $frame.prev().find('.ui-dialog-title').text(title);

Subscribers

People subscribed via source and target branches

to all changes: