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

Proposed by Vaibhav Darji
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~openerp-dev/openobject-client-web/dialog-current-target
Merge into: lp:openobject-client-web/trunk
Diff against target: 70 lines (+32/-22)
1 file modified
addons/openerp/static/javascript/openerp/openerp.base.js (+32/-22)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/dialog-current-target
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Disapprove
Review via email: mp+42926@code.launchpad.net

Description of the change

If dialog is already present and next url target is current so should be open in dialog box.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Actions with target=current are to open in the main content area (when everything is done they'll open in a new tab, but currently they replace current content) and close the dialog box if there is a dialog box open. Opening them in a dialog box is incorrect.

review: Disapprove

Unmerged revisions

4040. By Vaibhav Darji

[FIX] Issue of popup(If dialog is already present and next url target is current so should be open in dialog box).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
2--- addons/openerp/static/javascript/openerp/openerp.base.js 2010-12-07 06:45:57 +0000
3+++ addons/openerp/static/javascript/openerp/openerp.base.js 2010-12-07 11:35:13 +0000
4@@ -101,34 +101,44 @@
5 var $dialogs = jQuery('.action-dialog');
6 switch(target) {
7 case 'new':
8- var $contentFrame = jQuery('<iframe>', {
9- src: action_url,
10- frameborder: 0,
11- width: '99%',
12- height: '99%'
13- });
14- jQuery('<div class="action-dialog">')
15- .appendTo(document.documentElement)
16- .dialog({
17- modal: true,
18- width: 640,
19- height: 480,
20- close: function () {
21- var $this = jQuery(this);
22- $this.find('iframe').remove();
23- setTimeout(function () {
24- $this.dialog('destroy').remove();
25- });
26- }
27- })
28- .append($contentFrame);
29+ open_dialog_box(action_url)
30 break;
31 case 'current':
32 default:
33- openLink(action_url);
34+ if (jQuery('iframe').length || jQuery('.action-dialog').length) {
35+ open_dialog_box(action_url);
36+ }
37+ else {
38+ openLink(action_url);
39+ }
40 }
41 $dialogs.dialog('close');
42 }
43+
44+function open_dialog_box(action_url) {
45+ var $contentFrame = jQuery('<iframe>', {
46+ src: action_url,
47+ frameborder: 0,
48+ width: '99%',
49+ height: '99%'
50+ });
51+ jQuery('<div class="action-dialog">')
52+ .appendTo(document.documentElement)
53+ .dialog({
54+ modal: true,
55+ width: 640,
56+ height: 480,
57+ close: function () {
58+ var $this = jQuery(this);
59+ $this.find('iframe').remove();
60+ setTimeout(function () {
61+ $this.dialog('destroy').remove();
62+ });
63+ }
64+ })
65+ .append($contentFrame);
66+}
67+
68 function closeAction() {
69 jQuery('.action-dialog').dialog('close');
70 }