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

Subscribers

People subscribed via source and target branches

to all changes: