Merge lp:~openerp-dev/openerp-web/trunk-bootstrap-modal-csn into lp:openerp-web

Proposed by Cedric Snauwaert (OpenERP)
Status: Merged
Merged at revision: 3972
Proposed branch: lp:~openerp-dev/openerp-web/trunk-bootstrap-modal-csn
Merge into: lp:openerp-web
Diff against target: 980 lines (+137/-400)
9 files modified
addons/web/static/src/css/base.css (+17/-155)
addons/web/static/src/css/base.sass (+17/-111)
addons/web/static/src/js/chrome.js (+64/-93)
addons/web/static/src/js/data_export.js (+0/-2)
addons/web/static/src/js/view_form.js (+17/-22)
addons/web/static/src/js/views.js (+5/-5)
addons/web/static/src/xml/base.xml (+14/-1)
addons/web_diagram/static/src/js/diagram.js (+1/-7)
addons/web_view_editor/static/src/js/view_editor.js (+2/-4)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-bootstrap-modal-csn
Reviewer Review Type Date Requested Status
Victor Tabuenca (OpenERP) (community) Needs Fixing
Xavier (Open ERP) (community) Approve
Review via email: mp+215157@code.launchpad.net
To post a comment you must log in.
3970. By Cedric Snauwaert (OpenERP)

[FIX]forgot to open a dialog

3971. By Cedric Snauwaert (OpenERP)

[FIX]modal strict to bootstrap: no resize and only use 3 size, large-medium-small instead of changing width of modal

3972. By Cedric Snauwaert (OpenERP)

[FIX]remove draggable on modal window + clean up

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

I don't see much to say, mostly cosmetic stuff

* In the section "Customized modal according bootstrap3", some of the intentation is unnecessary:

    .modal-header
        button.close

  should be

    .modal-header button.close

  and

    .oe_act_window
        &.modal-body

  should be

    .oe_act_window.modal-body

* this.$buttons.insertAfter(this.$dialog_box.find(".modal-body")); feels a bit back-and-forth-y, any reason why it's not

    this.$dialog_box.find(".modal-body")).append(this.$buttons)

  ?

* why not a switch/case instead of nested conditionals to handle dialog sizes? Why get the element based on a size class rather than .modal-dialog (which is the same element according to the template)?

* please prefix variables holding jquery objects with `$` to differentiate them from non-jquery DOM objects (e.g. dialog_body)

* variables naming is a bit weird, e.g. $dialog_box.find('.modal-content') is stored into dialog_body even though there's a $dialog_box.find('.modal-body') (which is fetched repeatedly but not stored)

* missing spaces after commas in parameter names

* any reason for modal_size parameter instead of just size?

review: Approve
3973. By Cedric Snauwaert (OpenERP)

[FIX]few cosmetic of code

Revision history for this message
Victor Tabuenca (OpenERP) (vta-openerp) wrote :

Hi Cedric!

@@ -1956,26 +1955,23 @@
746 var exec_action = function() {
747 if (self.node.attrs.confirm) {
748 var def = $.Deferred();
749 - var dialog = instance.web.dialog($('<div/>').text(self.node.attrs.confirm), {
750 + var dialog = instance.web.Dialog(this, {

Since the helper function seems to had been removed, the object should be instantiated using the 'new' operator.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/css/base.css'
2--- addons/web/static/src/css/base.css 2014-04-10 10:55:25 +0000
3+++ addons/web/static/src/css/base.css 2014-04-11 12:28:17 +0000
4@@ -127,7 +127,7 @@
5 font-weight: bold;
6 font-size: inherit;
7 }
8-.openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp .oe_button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button {
9+.openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp .oe_button, .openerp input[type='submit'] {
10 display: inline-block;
11 border: 1px solid rgba(0, 0, 0, 0.4);
12 color: #4c4c4c;
13@@ -152,7 +152,7 @@
14 -webkit-font-smoothing: antialiased;
15 outline: none;
16 }
17-.openerp a.button:hover, .openerp button:hover, .openerp .oe_button:hover, .openerp input[type='submit']:hover, .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-hover {
18+.openerp a.button:hover, .openerp button:hover, .openerp .oe_button:hover, .openerp input[type='submit']:hover {
19 background-color: #ececec;
20 background-image: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3));
21 background-image: -webkit-linear-gradient(top, #f6f6f6, #e3e3e3);
22@@ -163,7 +163,7 @@
23 cursor: pointer;
24 background-position: 0;
25 }
26-.openerp a.button:focus, .openerp button:focus, .openerp .oe_button:focus, .openerp input[type='submit']:focus, .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-focus {
27+.openerp a.button:focus, .openerp button:focus, .openerp .oe_button:focus, .openerp input[type='submit']:focus {
28 border: 1px solid #80bfff;
29 background-position: 0;
30 background-color: #ececec;
31@@ -177,7 +177,7 @@
32 -webkit-box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset;
33 box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset;
34 }
35-.openerp a.button:active, .openerp a.button.active, .openerp button:active, .openerp .oe_button:active, .openerp .oe_button.active, .openerp input[type='submit']:active, .openerp input[type='submit'].active, .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-active {
36+.openerp a.button:active, .openerp a.button.active, .openerp button:active, .openerp .oe_button:active, .openerp .oe_button.active, .openerp input[type='submit']:active, .openerp input[type='submit'].active {
37 background-color: #ececec;
38 background-image: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6));
39 background-image: -webkit-linear-gradient(top, #e3e3e3, #f6f6f6);
40@@ -212,148 +212,6 @@
41 .openerp .ui-tabs {
42 position: static;
43 }
44-.openerp.ui-dialog {
45- display: none;
46- height: auto !important;
47- padding: 6px;
48- background-color: rgba(60, 60, 60, 0.7);
49- border: 1px solid;
50- border-color: #888888 #555555 #444444;
51- -moz-border-radius: 8px;
52- -webkit-border-radius: 8px;
53- border-radius: 8px;
54- -moz-box-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
55- -webkit-box-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
56- box-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
57- -webkit-background-clip: padding-box;
58- -moz-background-clip: padding-box;
59- background-clip: padding-box;
60-}
61-.openerp.ui-dialog .ui-dialog-content {
62- padding: 0;
63-}
64-.openerp.ui-dialog .ui-dialog-titlebar, .openerp.ui-dialog .ui-dialog-content, .openerp.ui-dialog .ui-dialog-buttonpane {
65- padding: 16px;
66-}
67-.openerp.ui-dialog .ui-dialog-titlebar {
68- border-top: none;
69- border-left: none;
70- border-right: none;
71- border-bottom: 1px solid #cacaca;
72- -moz-border-radius: 2px 2px 0 0;
73- -webkit-border-radius: 2px 2px 0 0;
74- border-radius: 2px 2px 0 0;
75- background-color: #ededed;
76- background-image: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#dedede));
77- background-image: -webkit-linear-gradient(top, #fcfcfc, #dedede);
78- background-image: -moz-linear-gradient(top, #fcfcfc, #dedede);
79- background-image: -ms-linear-gradient(top, #fcfcfc, #dedede);
80- background-image: -o-linear-gradient(top, #fcfcfc, #dedede);
81- background-image: linear-gradient(to bottom, #fcfcfc, #dedede);
82-}
83-.openerp.ui-dialog .ui-dialog-titlebar .ui-dialog-title {
84- margin: 0;
85- padding: 0;
86-}
87-.openerp.ui-dialog .ui-dialog-content {
88- background: white;
89- width: auto !important;
90-}
91-.openerp.ui-dialog .ui-dialog-buttonpane {
92- border-top: 1px solid #e0e0e0;
93- background: #f5f7f9;
94- margin: 0;
95- -moz-border-radius: 0 0 2px 2px;
96- -webkit-border-radius: 0 0 2px 2px;
97- border-radius: 0 0 2px 2px;
98-}
99-.openerp.ui-dialog .ui-dialog-buttonpane button {
100- margin: 0 4px 0 0;
101-}
102-.openerp.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
103- float: left;
104-}
105-.openerp.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button {
106- margin-right: 4px;
107-}
108-.openerp.ui-dialog .ui-dialog-titlebar-close {
109- padding: 0;
110-}
111-.openerp.ui-dialog .ui-dialog-titlebar-close .ui-icon-closethick {
112- display: none;
113-}
114-.openerp.ui-dialog .ui-dialog-titlebar-close:before {
115- content: "×";
116- font-size: 18px;
117- font-weight: bold;
118- line-height: 16px;
119- color: black;
120- text-shadow: 0 1px 0 white;
121- padding: 0;
122- cursor: pointer;
123- background: transparent;
124- border: 0;
125-}
126-.openerp.ui-dialog .ui-dialog-titlebar-close:before:hover {
127- color: black;
128- text-decoration: none;
129-}
130-.openerp.ui-dialog .oe_about {
131- background-color: white;
132- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=);
133- -moz-border-radius: 0 0 2px 2px;
134- -webkit-border-radius: 0 0 2px 2px;
135- border-radius: 0 0 2px 2px;
136-}
137-.openerp.ui-dialog .oe_about a {
138- color: #7c7bad;
139-}
140-.openerp.ui-dialog .oe_about a:hover {
141- text-decoration: underline;
142-}
143-.openerp.ui-dialog .oe_about a:focus {
144- outline: none;
145-}
146-.openerp.ui-dialog .oe_about .oe_logo {
147- margin-left: -6px;
148-}
149-.openerp.ui-dialog .oe_about .oe_bottom {
150- position: absolute;
151- top: 50%;
152- left: 0;
153- right: 0;
154- bottom: 0;
155- text-shadow: 0 1px 1px #999999;
156- background-color: #8a0e0e;
157- background-image: -webkit-gradient(linear, left top, left bottom, from(#b41616), to(#600606));
158- background-image: -webkit-linear-gradient(top, #b41616, #600606);
159- background-image: -moz-linear-gradient(top, #b41616, #600606);
160- background-image: -ms-linear-gradient(top, #b41616, #600606);
161- background-image: -o-linear-gradient(top, #b41616, #600606);
162- background-image: linear-gradient(to bottom, #b41616, #600606);
163- color: #eeeeee;
164- padding: 0 16px;
165- -moz-border-radius: 0 0 2px 2px;
166- -webkit-border-radius: 0 0 2px 2px;
167- border-radius: 0 0 2px 2px;
168-}
169-.openerp.ui-dialog .oe_about .oe_bottom a {
170- color: #eeeeee;
171-}
172-.openerp.ui-dialog.oe_act_window .ui-dialog-content {
173- padding: 0px;
174-}
175-.openerp .modal-backdrop {
176- position: fixed;
177- top: 0;
178- right: 0;
179- bottom: 0;
180- left: 0;
181- z-index: 1040;
182- background-color: black;
183- filter: alpha(opacity=30);
184- opacity: 0.3;
185-}
186 .openerp .oe_i {
187 font-family: "mnmliconsRegular" !important;
188 font-size: 21px;
189@@ -1233,11 +1091,6 @@
190 margin-left: -6px;
191 }
192 .openerp .oe_about .oe_bottom {
193- position: absolute;
194- top: 50%;
195- left: 0;
196- right: 0;
197- bottom: 0;
198 text-shadow: 0 1px 1px #999999;
199 background-color: #8a0e0e;
200 background-image: -webkit-gradient(linear, left top, left bottom, from(#b41616), to(#600606));
201@@ -3425,9 +3278,6 @@
202 .openerp_ie ul.oe_form_status li.oe_active > .arrow span, .openerp_ie ul.oe_form_status_clickable li.oe_active > .arrow span {
203 background-color: #729fcf !important;
204 }
205-.openerp_ie .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button {
206- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#EFEFEF', endColorstr='#D8D8D8');
207-}
208
209 @media print {
210 .openerp {
211@@ -3473,7 +3323,19 @@
212 width: 18px;
213 height: 18px;
214 }
215-
216+.modal .modal-header button.close {
217+ border: none;
218+ background: none;
219+ padding: 1px;
220+ height: 18px;
221+ font-size: 20px;
222+}
223+.modal .modal-footer {
224+ text-align: left;
225+}
226+.modal .oe_act_window.modal-body{
227+ padding: 0;
228+}
229 input[type="radio"], input[type="checkbox"] {
230 margin-right: 4px;
231 margin-left: 4px;
232
233=== modified file 'addons/web/static/src/css/base.sass'
234--- addons/web/static/src/css/base.sass 2014-04-10 10:55:25 +0000
235+++ addons/web/static/src/css/base.sass 2014-04-11 12:28:17 +0000
236@@ -218,7 +218,7 @@
237 font-size: inherit
238 // }}}
239 // Button style {{{
240- a.button:link, a.button:visited, button, .oe_button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button
241+ a.button:link, a.button:visited, button, .oe_button, input[type='submit']
242 display: inline-block
243 border: 1px solid rgba(0,0,0,0.4)
244 color: #4c4c4c
245@@ -233,18 +233,18 @@
246 -webkit-font-smoothing: antialiased
247 outline: none
248
249- a.button:hover, button:hover,.oe_button:hover, input[type='submit']:hover, .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-hover
250+ a.button:hover, button:hover,.oe_button:hover, input[type='submit']:hover
251 @include vertical-gradient(#f6f6f6, #e3e3e3)
252 cursor: pointer
253 background-position: 0
254
255- a.button:focus, button:focus, .oe_button:focus, input[type='submit']:focus, .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-focus
256+ a.button:focus, button:focus, .oe_button:focus, input[type='submit']:focus
257 border: 1px solid #80bfff
258 background-position: 0
259 @include vertical-gradient(#f6f6f6, #e3e3e3)
260 @include box-shadow((0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, .8) inset))
261
262- a.button:active, a.button.active, button:active, .oe_button:active, .oe_button.active, input[type='submit']:active, input[type='submit'].active, .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-active
263+ a.button:active, a.button.active, button:active, .oe_button:active, .oe_button.active, input[type='submit']:active, input[type='submit'].active
264 @include vertical-gradient(#e3e3e3, #f6f6f6)
265 @include box-shadow(none)
266
267@@ -272,105 +272,6 @@
268 .ui-tabs
269 position: static
270
271- // Modal box
272- &.ui-dialog
273- display: none
274- height: auto !important
275- padding: 6px
276- //overflow: hidden
277- background-color: rgba(60,60,60,0.7)
278- border: 1px solid
279- border-color: #888 #555 #444
280- //overflow: hidden
281- @include radius(8px)
282- @include box-shadow(0 1px 12px rgba(0, 0, 0, 0.6))
283- @include background-clip()
284- .ui-dialog-content
285- padding: 0
286- .ui-dialog-titlebar, .ui-dialog-content, .ui-dialog-buttonpane
287- padding: 16px
288- .ui-dialog-titlebar
289- border-top: none
290- border-left: none
291- border-right: none
292- border-bottom: 1px solid #cacaca
293- @include radius(2px 2px 0 0)
294- @include vertical-gradient(#FCFCFC, #DEDEDE)
295- .ui-dialog-title
296- margin: 0
297- padding: 0
298- .ui-dialog-content
299- background: white
300- width: auto !important
301- .ui-dialog-buttonpane
302- border-top: 1px solid #e0e0e0
303- background: #f5f7f9
304- margin: 0
305- @include radius(0 0 2px 2px)
306- button
307- margin: 0 4px 0 0
308- .ui-dialog-buttonset
309- float: left
310- .ui-button
311- margin-right: 4px
312- .ui-dialog-titlebar-close
313- padding: 0
314- .ui-icon-closethick
315- display: none
316- &:before
317- content: "×"
318- font-size: 18px
319- font-weight: bold
320- line-height: 16px
321- color: black
322- text-shadow: 0 1px 0 white
323- padding: 0
324- cursor: pointer
325- background: transparent
326- border: 0
327- &:hover
328- color: black
329- text-decoration: none
330- .oe_about
331- background-color: white
332- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
333- @include radius(0 0 2px 2px)
334- a
335- color: $link-color
336- &:hover
337- text-decoration: underline
338- &:focus
339- outline: none
340- .oe_logo
341- margin-left: -6px
342- .oe_bottom
343- position: absolute
344- top: 50%
345- left: 0
346- right: 0
347- bottom: 0
348- text-shadow: 0 1px 1px #999999
349- @include vertical-gradient(#b41616, #600606)
350- color: #eee
351- padding: 0 16px
352- @include radius(0 0 2px 2px)
353- a
354- color: #eee
355-
356- &.ui-dialog.oe_act_window
357- .ui-dialog-content
358- padding: 0px
359-
360- .modal-backdrop
361- position: fixed
362- top: 0
363- right: 0
364- bottom: 0
365- left: 0
366- z-index: 1040
367- background-color: black
368- @include opacity(.3)
369-
370 // }}}
371 // Generic classes {{{
372 .oe_i
373@@ -1030,11 +931,6 @@
374 .oe_logo
375 margin-left: -6px
376 .oe_bottom
377- position: absolute
378- top: 50%
379- left: 0
380- right: 0
381- bottom: 0
382 text-shadow: 0 1px 1px #999999
383 @include vertical-gradient(#b41616, #600606)
384 color: #eee
385@@ -2764,9 +2660,6 @@
386 > .arrow span
387 background-color: #729fcf !important
388
389- // jquery ui for ie
390- .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button
391- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#EFEFEF', endColorstr='#D8D8D8')
392 // }}}
393
394 // @media print {{{
395@@ -2811,6 +2704,19 @@
396 height: 18px
397 // End hack}}}
398
399+// Customized modal according bootstrap3
400+.modal
401+ .modal-header button.close
402+ border: none
403+ background: none
404+ padding: 1px
405+ height: 18px
406+ font-size: 20px
407+ .modal-footer
408+ text-align: left
409+ .oe_act_window.modal-body
410+ padding: 0
411+
412 input[type="radio"], input[type="checkbox"]
413 margin-right: 4px
414 margin-left: 4px
415
416=== modified file 'addons/web/static/src/js/chrome.js'
417--- addons/web/static/src/js/chrome.js 2014-04-07 16:17:28 +0000
418+++ addons/web/static/src/js/chrome.js 2014-04-11 12:28:17 +0000
419@@ -57,16 +57,6 @@
420 instance.web.client_actions.add("action_warn", "instance.web.action_warn");
421
422 /**
423- * The very minimal function everything should call to create a dialog
424- * in OpenERP Web Client.
425- */
426-instance.web.dialog = function(element) {
427- var result = element.dialog.apply(element, _.rest(_.toArray(arguments)));
428- result.dialog("widget").openerpClass();
429- return result;
430-};
431-
432-/**
433 A useful class to handle dialogs.
434
435 Attributes:
436@@ -81,6 +71,8 @@
437 @param {Widget} parent
438 @param {dictionary} options A dictionary that will be forwarded to jQueryUI Dialog. Additionaly, that
439 dictionary can contain the following keys:
440+ - size: one of the following: 'large', 'medium', 'small'
441+ - dialogClass: class to add to the body of dialog
442 - buttons: Deprecated. The buttons key is not propagated to jQueryUI Dialog. It must be a dictionary (key = button
443 label, value = click handler) or a list of dictionaries (each element in the dictionary is send to the
444 corresponding method of a jQuery element targeting the <button> tag). It is deprecated because all dialogs
445@@ -94,57 +86,15 @@
446 this._super(parent);
447 this.content_to_set = content;
448 this.dialog_options = {
449- modal: true,
450 destroy_on_close: true,
451- width: 900,
452- min_width: 0,
453- max_width: '95%',
454- height: 'auto',
455- min_height: 0,
456- max_height: $(window.top).height() - 200,
457- autoOpen: false,
458- position: [false, 40],
459+ size: 'large', //'medium', 'small'
460 buttons: null,
461- resizeStop: function() {
462- self.trigger("resized");
463- },
464 };
465 if (options) {
466 _.extend(this.dialog_options, options);
467 }
468 this.on("closing", this, this._closing);
469- this.$buttons = $('<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"><span class="oe_dialog_custom_buttons"/></div>');
470- },
471- _get_options: function() {
472- var self = this;
473- var o = _.extend({}, this.dialog_options);
474- var sizes = {
475- width: $(window.top).width(),
476- height: $(window.top).height(),
477- };
478- _.each(sizes, function(available_size, unit) {
479- o[unit] = self._get_size(o[unit], available_size);
480- o['min_' + unit] = self._get_size(o['min_' + unit] || 0, available_size);
481- o['max_' + unit] = self._get_size(o['max_' + unit] || 0, available_size);
482- if (o[unit] !== 'auto' && o['min_' + unit] && o[unit] < o['min_' + unit]) {
483- o[unit] = o['min_' + unit];
484- }
485- if (o[unit] !== 'auto' && o['max_' + unit] && o[unit] > o['max_' + unit]) {
486- o[unit] = o['max_' + unit];
487- }
488- });
489- o.title = o.title || this.dialog_title;
490- return o;
491- },
492- _get_size: function(val, available_size) {
493- val = val.toString();
494- if (val === 'auto') {
495- return val;
496- } else if (val.slice(-1) === "%") {
497- return Math.round(available_size / 100 * parseInt(val.slice(0, -1), 10));
498- } else {
499- return parseInt(val, 10);
500- }
501+ this.$buttons = $('<div class="modal-footer"><span class="oe_dialog_custom_buttons"/></div>');
502 },
503 renderElement: function() {
504 if (this.content_to_set) {
505@@ -162,8 +112,7 @@
506 if (!this.dialog_inited) {
507 this.init_dialog();
508 }
509- this.$el.dialog('open');
510- this.$el.dialog("widget").append(this.$buttons);
511+ this.$buttons.insertAfter(this.$dialog_box.find(".modal-body"));
512 return this;
513 },
514 _add_buttons: function(buttons) {
515@@ -188,16 +137,39 @@
516 @return The result returned by start().
517 */
518 init_dialog: function() {
519- var options = this._get_options();
520+ var self = this;
521+ var options = _.extend({}, this.dialog_options);
522+ options.title = options.title || this.dialog_title;
523 if (options.buttons) {
524 this._add_buttons(options.buttons);
525 delete(options.buttons);
526 }
527 this.renderElement();
528- instance.web.dialog(this.$el, options);
529- if (options.height === 'auto' && options.max_height) {
530- this.$el.css({ 'max-height': options.max_height, 'overflow-y': 'auto' });
531- }
532+
533+ this.$dialog_box = $(QWeb.render('Dialog', options)).appendTo("body");
534+ this.$el.modal({
535+ 'backdrop': false,
536+ 'keyboard': true,
537+ });
538+ if (options.size !== 'large'){
539+ var dialog_class_size = this.$dialog_box.find('.modal-lg').removeClass('modal-lg')
540+ if (options.size === 'small'){
541+ dialog_class_size.addClass('modal-sm');
542+ }
543+ }
544+
545+ this.$el.appendTo(this.$dialog_box.find(".modal-body"));
546+ var $dialog_content = this.$dialog_box.find('.modal-content');
547+ if (options.dialogClass){
548+ $dialog_content.find(".modal-body").addClass(options.dialogClass);
549+ }
550+ $dialog_content.openerpClass();
551+
552+ this.$dialog_box.on('hidden.bs.modal', this, function(){
553+ self.trigger("closing");
554+ });
555+ this.$dialog_box.modal('show');
556+
557 this.dialog_inited = true;
558 var res = this.start();
559 return res;
560@@ -206,9 +178,8 @@
561 Closes the popup, if destroy_on_close was passed to the constructor, it is also destroyed.
562 */
563 close: function(reason) {
564- if (this.dialog_inited && this.$el.is(":data(dialog)")) {
565- this.trigger("closing", reason);
566- this.$el.dialog('close');
567+ if (this.dialog_inited && this.$el.is(":data(bs.modal)")) {
568+ this.$el.parents('.modal').modal('hide');
569 }
570 },
571 _closing: function() {
572@@ -233,8 +204,8 @@
573 this.close(reason);
574 this.__tmp_dialog_destroying = undefined;
575 }
576- if (this.dialog_inited && !this.isDestroyed() && this.$el.is(":data(dialog)")) {
577- this.$el.dialog('destroy');
578+ if (this.dialog_inited && !this.isDestroyed() && this.$el.is(":data(bs.modal)")) {
579+ this.$el.parents('.modal').remove();
580 }
581 this._super();
582 }
583@@ -272,12 +243,13 @@
584 if (error.data.exception_type === "except_osv") {
585 error = _.extend({}, error, {data: _.extend({}, error.data, {message: error.data.arguments[0] + "\n\n" + error.data.arguments[1]})});
586 }
587- instance.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), {
588+ new instance.web.Dialog(this, {
589+ size: 'medium',
590 title: "OpenERP " + (_.str.capitalize(error.type) || "Warning"),
591 buttons: [
592- {text: _t("Ok"), click: function() { $(this).dialog("close"); }}
593- ]
594- });
595+ {text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
596+ ],
597+ }, $('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>')).open();
598 },
599 show_error: function(error) {
600 if (!this.active) {
601@@ -285,17 +257,12 @@
602 }
603 var buttons = {};
604 buttons[_t("Ok")] = function() {
605- $(this).dialog("close");
606+ this.parents('.modal').modal('hide');
607 };
608- var dialog = new instance.web.Dialog(this, {
609+ new instance.web.Dialog(this, {
610 title: "OpenERP " + _.str.capitalize(error.type),
611- width: '80%',
612- height: '50%',
613- min_width: '800px',
614- min_height: '600px',
615 buttons: buttons
616- }).open();
617- dialog.$el.html(QWeb.render('CrashManager.error', {session: instance.session, error: error}));
618+ }, QWeb.render('CrashManager.error', {session: instance.session, error: error})).open();
619 },
620 show_message: function(exception) {
621 this.show_error({
622@@ -342,16 +309,17 @@
623 error = this.error;
624 error.data.message = error.data.arguments[0];
625
626- instance.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), {
627+ new instance.web.Dialog(this, {
628+ size: 'medium',
629 title: "OpenERP " + (_.str.capitalize(error.type) || "Warning"),
630 buttons: [
631- {text: _t("Ok"), click: function() { $(this).dialog("close"); }},
632+ {text: _t("Ok"), click: function() { this.$el.parents('.modal').modal('hide'); }},
633 {text: error.data.arguments[2], click: function() {
634 window.location.href='#action='+error.data.arguments[1];
635- $(this).dialog("close");
636+ this.$el.parents('.modal').modal('hide');
637 }}
638- ]
639- });
640+ ],
641+ }, QWeb.render('CrashManager.warning', {error: error})).open();
642 this.destroy();
643 }
644 });
645@@ -498,13 +466,13 @@
646 * @param {String} error.error message of the error dialog
647 */
648 display_error: function (error) {
649- return instance.web.dialog($('<div>'), {
650- modal: true,
651+ return new instance.web.Dialog(this, {
652+ size: 'medium',
653 title: error.title,
654 buttons: [
655- {text: _t("Ok"), click: function() { $(this).dialog("close"); }}
656+ {text: _t("Ok"), click: function() { this.$el.parents('.modal').modal('hide'); }}
657 ]
658- }).html(error.error);
659+ }, $('<div>').html(error.error)).open();
660 },
661 do_create: function(form) {
662 var self = this;
663@@ -731,13 +699,13 @@
664 });
665 },
666 display_error: function (error) {
667- return instance.web.dialog($('<div>'), {
668- modal: true,
669+ return new instance.web.Dialog(this, {
670+ size: 'medium',
671 title: error.title,
672 buttons: [
673- {text: _t("Ok"), click: function() { $(this).dialog("close"); }}
674+ {text: _t("Ok"), click: function() { this.$el.parents('.modal').modal('hide'); }}
675 ]
676- }).html(error.error);
677+ }, $('<div>').html(error.error)).open();
678 },
679 });
680 instance.web.client_actions.add("change_password", "instance.web.ChangePassword");
681@@ -1052,8 +1020,11 @@
682 e.preventDefault();
683 window.location = $.param.querystring( window.location.href, 'debug');
684 });
685- instance.web.dialog($help, {autoOpen: true,
686- modal: true, width: 507, height: 290, resizable: false, title: _t("About")});
687+ new instance.web.Dialog(this, {
688+ size: 'medium',
689+ dialogClass: 'oe_act_window',
690+ title: _t("About"),
691+ }, $help).open();
692 });
693 },
694 });
695
696=== modified file 'addons/web/static/src/js/data_export.js'
697--- addons/web/static/src/js/data_export.js 2014-03-18 11:27:43 +0000
698+++ addons/web/static/src/js/data_export.js 2014-04-11 12:28:17 +0000
699@@ -46,7 +46,6 @@
700 start: function() {
701 var self = this;
702 this._super.apply(this, arguments);
703- self.$el.removeClass('ui-dialog-content ui-widget-content');
704
705 var got_fields = new $.Deferred();
706 this.$el.find('#import_compat').change(function() {
707@@ -413,7 +412,6 @@
708 });
709 },
710 close: function() {
711- this.$el.remove();
712 this._super();
713 }
714 });
715
716=== modified file 'addons/web/static/src/js/view_form.js'
717--- addons/web/static/src/js/view_form.js 2014-04-10 10:55:25 +0000
718+++ addons/web/static/src/js/view_form.js 2014-04-11 12:28:17 +0000
719@@ -586,13 +586,13 @@
720 this._internal_set_values(result.value, processed);
721 }
722 if (!_.isEmpty(result.warning)) {
723- instance.web.dialog($(QWeb.render("CrashManager.warning", result.warning)), {
724+ new instance.web.Dialog(this, {
725+ size: 'medium',
726 title:result.warning.title,
727- modal: true,
728 buttons: [
729- {text: _t("Ok"), click: function() { $(this).dialog("close"); }}
730+ {text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
731 ]
732- });
733+ }, QWeb.render("CrashManager.warning", result.warning)).open();
734 }
735
736 return $.Deferred().resolve();
737@@ -1080,7 +1080,6 @@
738 };
739 })
740 .value();
741-
742 var d = new instance.web.Dialog(this, {
743 title: _t("Set Default"),
744 args: {
745@@ -1956,26 +1955,23 @@
746 var exec_action = function() {
747 if (self.node.attrs.confirm) {
748 var def = $.Deferred();
749- var dialog = instance.web.dialog($('<div/>').text(self.node.attrs.confirm), {
750+ var dialog = instance.web.Dialog(this, {
751 title: _t('Confirm'),
752- modal: true,
753 buttons: [
754 {text: _t("Cancel"), click: function() {
755- $(this).dialog("close");
756+ this.parents('.modal').modal('hide');
757 }
758 },
759 {text: _t("Ok"), click: function() {
760 var self2 = this;
761 self.on_confirmed().always(function() {
762- $(self2).dialog("close");
763+ self2.parents('.modal').modal('hide');
764 });
765 }
766 }
767 ],
768- beforeClose: function() {
769- def.resolve();
770- },
771- });
772+ }, $('<div/>').text(self.node.attrs.confirm)).open();
773+ dialog.on("closing", null, function() {def.resolve();});
774 return def.promise();
775 } else {
776 return self.on_confirmed();
777@@ -3234,7 +3230,7 @@
778 init: function(parent) {
779 this._super(parent, {
780 title: _.str.sprintf(_t("Add %s"), parent.string),
781- width: 312,
782+ size: 'medium',
783 });
784 },
785 start: function() {
786@@ -3302,7 +3298,7 @@
787 delete this.$drop_down;
788 }
789 if (this.$input) {
790- this.$input.closest(".ui-dialog .ui-dialog-content").off('scroll');
791+ this.$input.closest(".modal .modal-content").off('scroll');
792 this.$input.off('keyup blur autocompleteclose autocompleteopen ' +
793 'focus focusout change keydown');
794 delete this.$input;
795@@ -3395,7 +3391,7 @@
796 self.$input.autocomplete("close");
797 }
798 }, 50);
799- this.$input.closest(".ui-dialog .ui-dialog-content").on('scroll', this, close_autocomplete);
800+ this.$input.closest(".modal .modal-content").on('scroll', this, close_autocomplete);
801
802 self.ed_def = $.Deferred();
803 self.uned_def = $.Deferred();
804@@ -4921,13 +4917,12 @@
805 var self = this;
806 this.renderElement();
807 var dialog = new instance.web.Dialog(this, {
808- min_width: '800px',
809 dialogClass: 'oe_act_window',
810- close: function() {
811- self.check_exit(true);
812- },
813 title: this.options.title || "",
814 }, this.$el).open();
815+ dialog.on('closing', this, function (e){
816+ self.check_exit(true);
817+ });
818 this.$buttonpane = dialog.$buttons;
819 this.start();
820 },
821@@ -4994,8 +4989,8 @@
822 },
823 destroy: function () {
824 this.trigger('closed');
825- if (this.$el.is(":data(dialog)")) {
826- this.$el.dialog('close');
827+ if (this.$el.is(":data(bs.modal)")) {
828+ this.$el.parents('.modal').modal('hide');
829 }
830 this._super();
831 },
832
833=== modified file 'addons/web/static/src/js/views.js'
834--- addons/web/static/src/js/views.js 2014-04-07 16:17:28 +0000
835+++ addons/web/static/src/js/views.js 2014-04-11 12:28:17 +0000
836@@ -410,10 +410,10 @@
837 }
838 this.dialog_stop(executor.action);
839 this.dialog = new instance.web.Dialog(this, {
840+ title: executor.action.name,
841 dialogClass: executor.klass,
842 });
843 this.dialog.on("closing", null, options.on_close);
844- this.dialog.dialog_title = executor.action.name;
845 if (widget instanceof instance.web.ViewManager) {
846 _.extend(widget.flags, {
847 $buttons: this.dialog.$buttons,
848@@ -926,7 +926,7 @@
849 current_view = this.views[this.active_view].controller;
850 switch (val) {
851 case 'fvg':
852- var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open();
853+ var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get") }).open();
854 $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$el);
855 break;
856 case 'tests':
857@@ -943,7 +943,7 @@
858 this.dataset.call('perm_read', [ids]).done(function(result) {
859 var dialog = new instance.web.Dialog(this, {
860 title: _.str.sprintf(_t("View Log (%s)"), self.dataset.model),
861- width: 400
862+ size: 'medium',
863 }, QWeb.render('ViewManagerDebugViewLog', {
864 perm : result[0],
865 format : instance.web.format_value
866@@ -986,7 +986,7 @@
867 new instance.web.Dialog(self, {
868 title: _.str.sprintf(_t("Model %s fields"),
869 self.dataset.model),
870- width: '95%'}, $root).open();
871+ }, $root).open();
872 });
873 break;
874 case 'edit_workflow':
875@@ -1223,7 +1223,7 @@
876 domain = $.Deferred().resolve(undefined);
877 }
878 if (ids.length === 0) {
879- instance.web.dialog($("<div />").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
880+ new instance.web.Dialog(this, { title: _t("Warning"), size: 'medium',}, $("<div />").text(_t("You must choose at least one record."))).open();
881 return false;
882 }
883 var active_ids_context = {
884
885=== modified file 'addons/web/static/src/xml/base.xml'
886--- addons/web/static/src/xml/base.xml 2014-04-10 10:55:25 +0000
887+++ addons/web/static/src/xml/base.xml 2014-04-11 12:28:17 +0000
888@@ -32,7 +32,20 @@
889 <t t-esc="message"/>
890 </div>
891 </t>
892-
893+<t t-name="Dialog">
894+ <div class="modal" tabindex="-1" data-backdrop="static" role="dialog" aria-hidden="true">
895+ <div class="modal-dialog modal-lg">
896+ <div class="modal-content">
897+ <div class="modal-header">
898+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
899+ <h3 class="modal-title"><t t-raw="title"/></h3>
900+ </div>
901+ <div class="modal-body">
902+ </div>
903+ </div>
904+ </div>
905+ </div>
906+</t>
907 <t t-name="CrashManager.warning">
908 <table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning">
909 <tr>
910
911=== modified file 'addons/web_diagram/static/src/js/diagram.js'
912--- addons/web_diagram/static/src/js/diagram.js 2012-12-13 14:09:14 +0000
913+++ addons/web_diagram/static/src/js/diagram.js 2014-04-11 12:28:17 +0000
914@@ -101,7 +101,6 @@
915 params['connectors_fields'].push(self.fields[conn.attrs.name]['string']|| this.toTitleCase(conn.attrs.name));
916 params['connectors'].push(conn.attrs.name);
917 });
918-
919 this.rpc(
920 '/web_diagram/diagram/get_diagram_info',params).done(function(result) {
921 self.draw_diagram(result);
922@@ -179,11 +178,6 @@
923 var r = new Raphael(canvas, '100%','100%');
924
925 var graph = new CuteGraph(r,style,canvas.parentNode);
926-
927- var confirm_dialog = $('#dialog').dialog({
928- autoOpen: false,
929- title: _t("Are you sure?") });
930-
931
932 _.each(res_nodes, function(node) {
933 var n = new CuteNode(
934@@ -344,7 +338,7 @@
935 });
936 // We want to destroy the dummy edge after a creation cancel. This destroys it even if we save the changes.
937 // This is not a problem since the diagram is completely redrawn on saved changes.
938- pop.$el.bind("dialogbeforeclose",function(){
939+ pop.$el.parents('.modal').on('hidden.bs.modal', function (e){
940 if(dummy_cuteedge){
941 dummy_cuteedge.remove();
942 }
943
944=== modified file 'addons/web_view_editor/static/src/js/view_editor.js'
945--- addons/web_view_editor/static/src/js/view_editor.js 2014-02-17 12:04:53 +0000
946+++ addons/web_view_editor/static/src/js/view_editor.js 2014-04-11 12:28:17 +0000
947@@ -58,7 +58,6 @@
948 };
949 this.view_edit_dialog = new instance.web.Dialog(this, {
950 title: action_title,
951- width: 850,
952 buttons: [
953 {text: _t("Create"), click: function() { self.on_create_view(); }},
954 {text: _t("Edit"), click: function() { self.xml_element_id = 0; self.get_arch(); }},
955@@ -376,7 +375,6 @@
956 this.one_object = one_object;
957 this.edit_xml_dialog = new instance.web.Dialog(this, {
958 title: _.str.sprintf(_t("View Editor %d - %s"), self.main_view_id, self.model),
959- height: '90%',
960 buttons: [
961 {text: _t("Inherited View"), click: function(){
962 var selected_row = self.edit_xml_dialog.$el.find('.ui-selected');
963@@ -829,7 +827,7 @@
964 var self = this;
965 this.edit_node_dialog = new instance.web.Dialog(this,{
966 title: _t("Properties"),
967- width: 450,
968+ size: 'medium',
969 buttons: [
970 {text: _t("Update"), click: function () {
971 var warn = false, update_values = [];
972@@ -955,7 +953,7 @@
973 this.add_widget = [];
974 this.add_node_dialog = new instance.web.Dialog(this,{
975 title: _t("Properties"),
976- width: 450,
977+ size: 'medium',
978 buttons: [
979 {text: _t("Update"), click: function() {
980 var check_add_node = true, values = {};