← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-client-web/dialog-current-target into lp:openobject-client-web

 

vda(Open ERP) has proposed merging lp:~openerp-dev/openobject-client-web/dialog-current-target into lp:openobject-client-web.

Requested reviews:
  OpenERP SA's Web Client R&D (openerp-dev-web)
Related bugs:
  #681409 no menu in some pages which come at the end of a flow
  https://bugs.launchpad.net/bugs/681409


If dialog is already present and next url target is current so should be open in dialog box.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/dialog-current-target/+merge/42926
Your team OpenERP SA's Web Client R&D is requested to review the proposed merge of lp:~openerp-dev/openobject-client-web/dialog-current-target into lp:openobject-client-web.
=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
--- addons/openerp/static/javascript/openerp/openerp.base.js	2010-12-07 06:45:57 +0000
+++ addons/openerp/static/javascript/openerp/openerp.base.js	2010-12-07 11:35:13 +0000
@@ -101,34 +101,44 @@
     var $dialogs = jQuery('.action-dialog');
     switch(target) {
         case 'new':
-            var $contentFrame = jQuery('<iframe>', {
-                src: action_url,
-                frameborder: 0,
-                width: '99%',
-                height: '99%'
-            });
-            jQuery('<div class="action-dialog">')
-                .appendTo(document.documentElement)
-                .dialog({
-                    modal: true,
-                    width: 640,
-                    height: 480,
-                    close: function () {
-                        var $this = jQuery(this);
-                        $this.find('iframe').remove();
-                        setTimeout(function () {
-                            $this.dialog('destroy').remove();
-                        });
-                    }
-                })
-                .append($contentFrame);
+            open_dialog_box(action_url)
             break;
         case 'current':
         default:
-            openLink(action_url);
+            if (jQuery('iframe').length || jQuery('.action-dialog').length) {
+                open_dialog_box(action_url);
+            }
+            else {
+                openLink(action_url);
+            }
     }
     $dialogs.dialog('close');
 }
+
+function open_dialog_box(action_url) {
+    var $contentFrame = jQuery('<iframe>', {
+        src: action_url,
+        frameborder: 0,
+        width: '99%',
+        height: '99%'
+    });
+    jQuery('<div class="action-dialog">')
+        .appendTo(document.documentElement)
+        .dialog({
+            modal: true,
+            width: 640,
+            height: 480,
+            close: function () {
+                var $this = jQuery(this);
+                $this.find('iframe').remove();
+                setTimeout(function () {
+                    $this.dialog('destroy').remove();
+                });
+            }
+        })
+        .append($contentFrame);
+}
+
 function closeAction() {
     jQuery('.action-dialog').dialog('close');
 }


Follow ups