Merge lp:~openerp-dev/openerp-web/trunk-process_view-vja into lp:~openerp-dev/openerp-web/trunk-process-view
- trunk-process_view-vja
- Merge into trunk-process-view
Proposed by
Vishmita Jadeja (openerp)
Status: | Merged |
---|---|
Merged at revision: | 2977 |
Proposed branch: | lp:~openerp-dev/openerp-web/trunk-process_view-vja |
Merge into: | lp:~openerp-dev/openerp-web/trunk-process-view |
Diff against target: |
12896 lines (+6532/-2707) 37 files modified
addons/web/static/src/css/Makefile (+1/-1) addons/web/static/src/css/base.css (+70/-19) addons/web/static/src/css/base.sass (+29/-15) addons/web/static/src/js/chrome.js (+55/-55) addons/web/static/src/js/corelib.js (+22/-22) addons/web/static/src/js/coresetup.js (+80/-76) addons/web/static/src/js/data_export.js (+59/-59) addons/web/static/src/js/data_import.js (+28/-28) addons/web/static/src/js/search.js (+83/-83) addons/web/static/src/js/view_form.js (+128/-121) addons/web/static/src/js/view_list.js (+28/-28) addons/web/static/src/js/view_list_editable.js (+19/-19) addons/web/static/src/js/view_tree.js (+13/-13) addons/web/static/src/js/views.js (+36/-36) addons/web/static/src/xml/base.xml (+1/-1) addons/web/static/test/Widget.js (+22/-22) addons/web_calendar/static/src/js/calendar.js (+10/-10) addons/web_diagram/static/src/js/diagram.js (+9/-9) addons/web_gantt/static/src/js/gantt.js (+5/-5) addons/web_graph/static/src/js/graph.js (+14/-14) addons/web_graph/static/src/xml/web_graph.xml (+1/-1) addons/web_kanban/static/src/js/kanban.js (+44/-44) addons/web_kanban/static/src/xml/web_kanban.xml (+1/-1) addons/web_mobile/static/src/js/chrome_mobile.js (+29/-29) addons/web_mobile/static/src/js/form_mobile.js (+6/-6) addons/web_mobile/static/src/js/list_mobile.js (+5/-5) addons/web_process/__openerp__.py (+2/-1) addons/web_process/static/lib/dracula/dracula_algorithms.js (+0/-599) addons/web_process/static/lib/dracula/dracula_graffle.js (+0/-107) addons/web_process/static/lib/dracula/dracula_graph.coffee (+0/-524) addons/web_process/static/lib/dracula/dracula_graph.js (+0/-527) addons/web_process/static/lib/js/raphael.js (+5501/-0) addons/web_process/static/src/css/process.css (+10/-13) addons/web_process/static/src/js/process.js (+140/-142) addons/web_process/static/src/xml/web_process.xml (+28/-19) addons/web_tests/static/src/js/web_tests.js (+2/-2) addons/web_view_editor/static/src/js/view_editor.js (+51/-51) |
To merge this branch: | bzr merge lp:~openerp-dev/openerp-web/trunk-process_view-vja |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jiten (OpenERP) | Approve | ||
Review via email: mp+121157@code.launchpad.net |
Commit message
Description of the change
Replace dracula library with raphale JS in process view
To post a comment you must log in.
- 2973. By Vishmita Jadeja (openerp)
-
[Fix]css changes
- 2974. By Vishmita Jadeja (openerp)
-
[Merge]Merge trunk
- 2975. By Vishmita Jadeja (openerp)
-
[Fix]Resolve conflicts
Revision history for this message
Jiten (OpenERP) (jiten-openerp) : | # |
review:
Approve
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/Makefile' |
2 | --- addons/web/static/src/css/Makefile 2012-03-27 22:20:41 +0000 |
3 | +++ addons/web/static/src/css/Makefile 2012-08-27 06:09:20 +0000 |
4 | @@ -1,3 +1,3 @@ |
5 | base.css: base.sass |
6 | - sass -t expanded base.sass base.css |
7 | + sass --trace -t expanded base.sass base.css |
8 | |
9 | |
10 | === modified file 'addons/web/static/src/css/base.css' |
11 | --- addons/web/static/src/css/base.css 2012-08-24 10:44:36 +0000 |
12 | +++ addons/web/static/src/css/base.css 2012-08-27 06:09:20 +0000 |
13 | @@ -141,13 +141,6 @@ |
14 | background-image: -o-linear-gradient(top, #eeeeee, #dedede); |
15 | background-image: linear-gradient(to bottom, #eeeeee, #dedede); |
16 | } |
17 | -.openerp ul, .openerp li, .openerp ol { |
18 | - margin: 0; |
19 | - padding: 0; |
20 | -} |
21 | -.openerp li { |
22 | - list-style-type: none; |
23 | -} |
24 | .openerp input, .openerp textarea, .openerp select { |
25 | padding: 2px 4px; |
26 | border: 1px solid #cccccc; |
27 | @@ -162,6 +155,13 @@ |
28 | .openerp h4 { |
29 | margin: 4px 0; |
30 | } |
31 | +.openerp .oe_semantic_html_override ul, .openerp .oe_semantic_html_override li, .openerp .oe_semantic_html_override ol { |
32 | + margin: 0; |
33 | + padding: 0; |
34 | +} |
35 | +.openerp .oe_semantic_html_override ul li, .openerp .oe_semantic_html_override li li, .openerp .oe_semantic_html_override ol li { |
36 | + list-style-type: none; |
37 | +} |
38 | .openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button { |
39 | display: inline-block; |
40 | border: 1px solid #ababab; |
41 | @@ -454,13 +454,6 @@ |
42 | -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); |
43 | box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); |
44 | } |
45 | -.openerp ul.oe_flatlist, .openerp ol.oe_flatlist { |
46 | - margin: 0; |
47 | - padding: 0; |
48 | -} |
49 | -.openerp ul.oe_flatlist li, .openerp ol.oe_flatlist li { |
50 | - list-style-type: none; |
51 | -} |
52 | .openerp .oe_form_dirty .oe_highlight_on_dirty { |
53 | color: white; |
54 | background: #dc5f59; |
55 | @@ -633,6 +626,18 @@ |
56 | padding: 0 16px; |
57 | list-style: none; |
58 | zoom: 1; |
59 | + margin: 0; |
60 | + padding: 0; |
61 | +} |
62 | +.openerp .oe_notebook li { |
63 | + list-style-type: none; |
64 | +} |
65 | +.openerp .oe_notebook ul, .openerp .oe_notebook li, .openerp .oe_notebook ol { |
66 | + margin: 0; |
67 | + padding: 0; |
68 | +} |
69 | +.openerp .oe_notebook ul li, .openerp .oe_notebook li li, .openerp .oe_notebook ol li { |
70 | + list-style-type: none; |
71 | } |
72 | .openerp .oe_notebook.ui-corner-all { |
73 | -moz-border-radius: 0; |
74 | @@ -937,6 +942,13 @@ |
75 | -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); |
76 | box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); |
77 | } |
78 | +.openerp .oe_login .oe_login_pane ul, .openerp .oe_login .oe_login_pane li, .openerp .oe_login .oe_login_pane ol { |
79 | + margin: 0; |
80 | + padding: 0; |
81 | +} |
82 | +.openerp .oe_login .oe_login_pane ul li, .openerp .oe_login .oe_login_pane li li, .openerp .oe_login .oe_login_pane ol li { |
83 | + list-style-type: none; |
84 | +} |
85 | .openerp .oe_login .oe_login_pane h2 { |
86 | margin-top: 0; |
87 | font-size: 18px; |
88 | @@ -1016,6 +1028,13 @@ |
89 | background-image: -o-linear-gradient(top, #646060, #262626); |
90 | background-image: linear-gradient(to bottom, #646060, #262626); |
91 | } |
92 | +.openerp .oe_topbar ul, .openerp .oe_topbar li, .openerp .oe_topbar ol { |
93 | + margin: 0; |
94 | + padding: 0; |
95 | +} |
96 | +.openerp .oe_topbar ul li, .openerp .oe_topbar li li, .openerp .oe_topbar ol li { |
97 | + list-style-type: none; |
98 | +} |
99 | .openerp .oe_topbar .oe_topbar_item { |
100 | display: block; |
101 | padding: 5px 10px 7px; |
102 | @@ -1088,6 +1107,13 @@ |
103 | text-shadow: 0 1px 1px white; |
104 | padding-bottom: 16px; |
105 | } |
106 | +.openerp .oe_leftbar ul, .openerp .oe_leftbar li, .openerp .oe_leftbar ol { |
107 | + margin: 0; |
108 | + padding: 0; |
109 | +} |
110 | +.openerp .oe_leftbar ul li, .openerp .oe_leftbar li li, .openerp .oe_leftbar ol li { |
111 | + list-style-type: none; |
112 | +} |
113 | .openerp a.oe_logo { |
114 | width: 220px; |
115 | display: block; |
116 | @@ -1213,6 +1239,13 @@ |
117 | margin: 0px; |
118 | padding: 1px 4px; |
119 | } |
120 | +.openerp .oe_secondary_submenu .oe_menu_counter:hover { |
121 | + cursor: pointer; |
122 | + border: 1px solid #c81010; |
123 | + -moz-box-shadow: 0 0 2px #c81010; |
124 | + -webkit-box-shadow: 0 0 2px #c81010; |
125 | + box-shadow: 0 0 2px #c81010; |
126 | +} |
127 | .openerp .oe_secondary_submenu .oe_active { |
128 | background: #7c7bad; |
129 | border-top: 1px solid lightGray; |
130 | @@ -1283,6 +1316,13 @@ |
131 | width: 100%; |
132 | table-layout: fixed; |
133 | } |
134 | +.openerp .oe_view_manager table.oe_view_manager_header ul, .openerp .oe_view_manager table.oe_view_manager_header li, .openerp .oe_view_manager table.oe_view_manager_header ol { |
135 | + margin: 0; |
136 | + padding: 0; |
137 | +} |
138 | +.openerp .oe_view_manager table.oe_view_manager_header ul li, .openerp .oe_view_manager table.oe_view_manager_header li li, .openerp .oe_view_manager table.oe_view_manager_header ol li { |
139 | + list-style-type: none; |
140 | +} |
141 | .openerp .oe_view_manager table.oe_view_manager_header .oe_header_row { |
142 | clear: both; |
143 | text-shadow: 0 1px 1px white; |
144 | @@ -1952,7 +1992,7 @@ |
145 | .openerp .oe_form div.oe_form_configuration div.oe_horizontal_separator { |
146 | margin: 12px 0 8px 0; |
147 | } |
148 | -.openerp .oe_form div.oe_form_configuration p { |
149 | +.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol { |
150 | color: #aaaaaa; |
151 | max-width: 650px; |
152 | } |
153 | @@ -2401,6 +2441,20 @@ |
154 | float: right; |
155 | padding-left: 2px; |
156 | } |
157 | +.openerp .oe_form_field_status { |
158 | + margin: 0; |
159 | + padding: 0; |
160 | +} |
161 | +.openerp .oe_form_field_status ul, .openerp .oe_form_field_status li, .openerp .oe_form_field_status ol { |
162 | + margin: 0; |
163 | + padding: 0; |
164 | +} |
165 | +.openerp .oe_form_field_status ul li, .openerp .oe_form_field_status li li, .openerp .oe_form_field_status ol li { |
166 | + list-style-type: none; |
167 | +} |
168 | +.openerp .oe_form_field_status li { |
169 | + list-style-type: none; |
170 | +} |
171 | .openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page { |
172 | display: none; |
173 | } |
174 | @@ -2763,6 +2817,7 @@ |
175 | -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); |
176 | box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); |
177 | margin-top: 4px; |
178 | + border: 1px solid #afafb6; |
179 | } |
180 | .ui-menu .ui-menu-item { |
181 | width: 100%; |
182 | @@ -2788,7 +2843,3 @@ |
183 | -webkit-border-radius: 3px; |
184 | border-radius: 3px; |
185 | } |
186 | - |
187 | -.ui-widget-content { |
188 | - border: 1px solid #afafb6; |
189 | -} |
190 | |
191 | === modified file 'addons/web/static/src/css/base.sass' |
192 | --- addons/web/static/src/css/base.sass 2012-08-24 10:44:36 +0000 |
193 | +++ addons/web/static/src/css/base.sass 2012-08-27 06:09:20 +0000 |
194 | @@ -111,6 +111,16 @@ |
195 | content: $icon-name |
196 | color: $color |
197 | |
198 | +@mixin ul-html-override() |
199 | + margin: 0 |
200 | + padding: 0 |
201 | + li |
202 | + list-style-type: none |
203 | + |
204 | +@mixin semantic-html-override() |
205 | + ul, li, ol |
206 | + @include ul-html-override() |
207 | + |
208 | // }}} |
209 | // CSS animation bounces {{{ |
210 | @-moz-keyframes bounce |
211 | @@ -194,11 +204,6 @@ |
212 | @include vertical-gradient(#f0f0fa, #eeeef6) |
213 | .zebra tbody tr:hover td |
214 | @include vertical-gradient(#eee, #dedede) |
215 | - ul, li, ol |
216 | - margin: 0 |
217 | - padding: 0 |
218 | - li |
219 | - list-style-type: none |
220 | input, textarea, select |
221 | padding: 2px 4px |
222 | border: 1px solid #ccc |
223 | @@ -208,6 +213,8 @@ |
224 | vertical-align: middle |
225 | h4 |
226 | margin: 4px 0 |
227 | + .oe_semantic_html_override |
228 | + @include semantic-html-override |
229 | // }}} |
230 | // Button style {{{ |
231 | a.button:link, a.button:visited, button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button |
232 | @@ -391,12 +398,6 @@ |
233 | //@include vertical-gradient(lighten(#dc5f59, 3%), lighten(#b33630, 3%)) |
234 | @include box-shadow(0 0 1px rgba(0, 0, 0, 0.2)) |
235 | |
236 | - ul.oe_flatlist, ol.oe_flatlist |
237 | - margin: 0 |
238 | - padding: 0 |
239 | - li |
240 | - list-style-type: none |
241 | - |
242 | .oe_form_dirty |
243 | .oe_highlight_on_dirty |
244 | color: white |
245 | @@ -515,6 +516,8 @@ |
246 | padding: 0 16px |
247 | list-style: none |
248 | zoom: 1 |
249 | + @include ul-html-override |
250 | + @include semantic-html-override |
251 | .oe_notebook.ui-corner-all |
252 | @include radius(0) |
253 | .oe_notebook:before, .oe_notebook:after |
254 | @@ -734,6 +737,7 @@ |
255 | text-align: left |
256 | @include radius(8px) |
257 | @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9)) |
258 | + @include semantic-html-override |
259 | h2 |
260 | margin-top: 0 |
261 | font-size: 18px |
262 | @@ -799,6 +803,7 @@ |
263 | height: 31px |
264 | border-top: solid 1px #d3d3d3 |
265 | @include vertical-gradient(#646060, #262626) |
266 | + @include semantic-html-override |
267 | .oe_topbar_item |
268 | display: block |
269 | padding: 5px 10px 7px |
270 | @@ -849,6 +854,7 @@ |
271 | border-right: 1px solid $tag-border |
272 | text-shadow: 0 1px 1px white |
273 | padding-bottom: 16px |
274 | + @include semantic-html-override |
275 | a.oe_logo |
276 | width: 220px |
277 | display: block |
278 | @@ -951,6 +957,10 @@ |
279 | text-shadow: 0 1px 1px rgba(0,0,0,0.2) |
280 | margin: 0px |
281 | padding: 1px 4px |
282 | + &:hover |
283 | + cursor: pointer |
284 | + border: 1px solid #C81010 |
285 | + @include box-shadow(0 0 2px #C81010) |
286 | .oe_active |
287 | background: $link-color |
288 | border-top: 1px solid lightGray |
289 | @@ -1009,6 +1019,7 @@ |
290 | table.oe_view_manager_header |
291 | width: 100% |
292 | table-layout: fixed |
293 | + @include semantic-html-override |
294 | .oe_header_row |
295 | //min-height: 26px |
296 | //line-height: 26px |
297 | @@ -1521,7 +1532,7 @@ |
298 | div.oe_form_configuration |
299 | div.oe_horizontal_separator |
300 | margin: 12px 0 8px 0 |
301 | - p |
302 | + p, ul, ol |
303 | color: #aaa |
304 | max-width: 650px |
305 | label |
306 | @@ -1856,6 +1867,11 @@ |
307 | float: right |
308 | padding-left: 2px |
309 | // }}} |
310 | + // FormView.fieldstatus {{{ |
311 | + .oe_form_field_status |
312 | + @include semantic-html-override |
313 | + @include ul-html-override |
314 | + // }}} |
315 | // FormView.one2many {{{ |
316 | .oe_form .oe_form_field_one2many > .oe_view_manager |
317 | .oe_list_pager_single_page |
318 | @@ -2161,6 +2177,7 @@ |
319 | padding: 2px 0 |
320 | @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) |
321 | margin-top: 4px |
322 | + border: 1px solid $tag-border |
323 | .ui-menu-item |
324 | width: 100% |
325 | padding: 0 |
326 | @@ -2178,8 +2195,5 @@ |
327 | .ui-corner-all |
328 | @include radius(3px) |
329 | |
330 | -.ui-widget-content |
331 | - border: 1px solid $tag-border |
332 | - |
333 | // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css" |
334 | // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: |
335 | |
336 | === modified file 'addons/web/static/src/js/chrome.js' |
337 | --- addons/web/static/src/js/chrome.js 2012-08-21 17:12:05 +0000 |
338 | +++ addons/web/static/src/js/chrome.js 2012-08-27 06:09:20 +0000 |
339 | @@ -13,7 +13,7 @@ |
340 | }, |
341 | start: function() { |
342 | this._super.apply(this, arguments); |
343 | - this.$element.notify({ |
344 | + this.$el.notify({ |
345 | speed: 500, |
346 | expires: 2500 |
347 | }); |
348 | @@ -24,7 +24,7 @@ |
349 | if (sticky) { |
350 | opts.expires = false; |
351 | } |
352 | - this.$element.notify('create', { |
353 | + this.$el.notify('create', { |
354 | title: title, |
355 | text: text |
356 | }, opts); |
357 | @@ -35,7 +35,7 @@ |
358 | if (sticky) { |
359 | opts.expires = false; |
360 | } |
361 | - this.$element.notify('create', 'oe_notification_alert', { |
362 | + this.$el.notify('create', 'oe_notification_alert', { |
363 | title: title, |
364 | text: text |
365 | }, opts); |
366 | @@ -123,22 +123,22 @@ |
367 | if (! this.dialog_inited) |
368 | this.init_dialog(); |
369 | var o = this.get_options(options); |
370 | - instance.web.dialog(this.$element, o).dialog('open'); |
371 | + instance.web.dialog(this.$el, o).dialog('open'); |
372 | if (o.height === 'auto' && o.max_height) { |
373 | - this.$element.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); |
374 | + this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); |
375 | } |
376 | return this; |
377 | }, |
378 | init_dialog: function(options) { |
379 | this.renderElement(); |
380 | var o = this.get_options(options); |
381 | - instance.web.dialog(this.$element, o); |
382 | + instance.web.dialog(this.$el, o); |
383 | var res = this.start(); |
384 | this.dialog_inited = true; |
385 | return res; |
386 | }, |
387 | close: function() { |
388 | - this.$element.dialog('close'); |
389 | + this.$el.dialog('close'); |
390 | }, |
391 | on_close: function() { |
392 | if (this.__tmp_dialog_destroying) |
393 | @@ -161,7 +161,7 @@ |
394 | this.__tmp_dialog_destroying = undefined; |
395 | } |
396 | if (! this.isDestroyed()) { |
397 | - this.$element.dialog('destroy'); |
398 | + this.$el.dialog('destroy'); |
399 | } |
400 | this._super(); |
401 | } |
402 | @@ -224,7 +224,7 @@ |
403 | min_height: '600px', |
404 | buttons: buttons |
405 | }).open(); |
406 | - dialog.$element.html(QWeb.render('CrashManager.error', {session: instance.session, error: error})); |
407 | + dialog.$el.html(QWeb.render('CrashManager.error', {session: instance.session, error: error})); |
408 | }, |
409 | on_javascript_exception: function(exception) { |
410 | this.on_traceback({ |
411 | @@ -270,12 +270,12 @@ |
412 | this.count += increment; |
413 | if (this.count > 0) { |
414 | if (instance.session.debug) { |
415 | - this.$element.text(_.str.sprintf( _t("Loading (%d)"), this.count)); |
416 | + this.$el.text(_.str.sprintf( _t("Loading (%d)"), this.count)); |
417 | } else { |
418 | - this.$element.text(_t("Loading")); |
419 | + this.$el.text(_t("Loading")); |
420 | } |
421 | - this.$element.show(); |
422 | - this.getParent().$element.addClass('oe_wait'); |
423 | + this.$el.show(); |
424 | + this.getParent().$el.addClass('oe_wait'); |
425 | } else { |
426 | this.count = 0; |
427 | clearTimeout(this.long_running_timer); |
428 | @@ -284,8 +284,8 @@ |
429 | this.blocked_ui = false; |
430 | instance.web.unblockUI(); |
431 | } |
432 | - this.$element.fadeOut(); |
433 | - this.getParent().$element.removeClass('oe_wait'); |
434 | + this.$el.fadeOut(); |
435 | + this.getParent().$el.removeClass('oe_wait'); |
436 | } |
437 | } |
438 | }); |
439 | @@ -317,7 +317,7 @@ |
440 | do_render: function() { |
441 | var self = this; |
442 | instance.webclient.toggle_bars(true); |
443 | - self.$element.html(QWeb.render("DatabaseManager", { widget : self })); |
444 | + self.$el.html(QWeb.render("DatabaseManager", { widget : self })); |
445 | $('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self })); |
446 | $('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self })); |
447 | $('ul.oe_secondary_submenu > li:first').addClass('oe_active') |
448 | @@ -329,14 +329,14 @@ |
449 | event.preventDefault(); |
450 | }); |
451 | $('#back-to-login').click(self.do_exit); |
452 | - self.$element.find("td").addClass("oe_form_group_cell"); |
453 | - self.$element.find("tr td:first-child").addClass("oe_form_group_cell_label"); |
454 | - self.$element.find("label").addClass("oe_form_label"); |
455 | - self.$element.find("form[name=create_db_form]").validate({ submitHandler: self.do_create }); |
456 | - self.$element.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop }); |
457 | - self.$element.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup }); |
458 | - self.$element.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore }); |
459 | - self.$element.find("form[name=change_pwd_form]").validate({ |
460 | + self.$el.find("td").addClass("oe_form_group_cell"); |
461 | + self.$el.find("tr td:first-child").addClass("oe_form_group_cell_label"); |
462 | + self.$el.find("label").addClass("oe_form_label"); |
463 | + self.$el.find("form[name=create_db_form]").validate({ submitHandler: self.do_create }); |
464 | + self.$el.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop }); |
465 | + self.$el.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup }); |
466 | + self.$el.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore }); |
467 | + self.$el.find("form[name=change_pwd_form]").validate({ |
468 | messages: { |
469 | old_pwd: "Please enter your previous password", |
470 | new_pwd: "Please enter your new password", |
471 | @@ -349,7 +349,7 @@ |
472 | }); |
473 | }, |
474 | destroy: function () { |
475 | - this.$element.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty(); |
476 | + this.$el.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty(); |
477 | this._super(); |
478 | }, |
479 | /** |
480 | @@ -500,7 +500,7 @@ |
481 | }); |
482 | }, |
483 | do_exit: function () { |
484 | - this.$element.remove(); |
485 | + this.$el.remove(); |
486 | instance.webclient.toggle_bars(false); |
487 | this.do_action('login'); |
488 | } |
489 | @@ -533,8 +533,8 @@ |
490 | }, |
491 | start: function() { |
492 | var self = this; |
493 | - self.$element.find("form").submit(self.on_submit); |
494 | - self.$element.find('.oe_login_manage_db').click(function() { |
495 | + self.$el.find("form").submit(self.on_submit); |
496 | + self.$el.find('.oe_login_manage_db').click(function() { |
497 | self.do_action("database_manager"); |
498 | }); |
499 | var d; |
500 | @@ -584,7 +584,7 @@ |
501 | */ |
502 | do_login: function (db, login, password) { |
503 | var self = this; |
504 | - this.$element.removeClass('oe_login_invalid'); |
505 | + this.$el.removeClass('oe_login_invalid'); |
506 | self.$(".oe_login_pane").fadeOut("slow"); |
507 | return this.session.session_authenticate(db, login, password).pipe(function() { |
508 | if (self.has_local_storage) { |
509 | @@ -603,7 +603,7 @@ |
510 | self.trigger('login_successful'); |
511 | },function () { |
512 | self.$(".oe_login_pane").fadeIn("fast", function() { |
513 | - self.$element.addClass("oe_login_invalid"); |
514 | + self.$el.addClass("oe_login_invalid"); |
515 | }); |
516 | }); |
517 | }, |
518 | @@ -663,7 +663,7 @@ |
519 | template: "ChangePassword", |
520 | start: function() { |
521 | var self = this; |
522 | - self.$element.validate({ |
523 | + self.$el.validate({ |
524 | submitHandler: function (form) { |
525 | self.rpc("/web/session/change_password",{ |
526 | 'fields': $(form).serializeArray() |
527 | @@ -700,7 +700,7 @@ |
528 | }, |
529 | start: function() { |
530 | this._super.apply(this, arguments); |
531 | - this.$secondary_menus = this.getParent().$element.find('.oe_secondary_menus_container'); |
532 | + this.$secondary_menus = this.getParent().$el.find('.oe_secondary_menus_container'); |
533 | this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click); |
534 | return this.do_reload(); |
535 | }, |
536 | @@ -718,7 +718,7 @@ |
537 | $toplevel.hide(); |
538 | } |
539 | this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this })); |
540 | - this.$element.on('click', 'a[data-menu]', this.on_menu_click); |
541 | + this.$el.on('click', 'a[data-menu]', this.on_menu_click); |
542 | // Hide second level submenus |
543 | this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide(); |
544 | if (self.current_menu) { |
545 | @@ -733,7 +733,7 @@ |
546 | } |
547 | if (maximum_visible_links < this.data.data.children.length) { |
548 | var $more = $(QWeb.render('Menu.more')), |
549 | - $index = this.$element.find('li').eq(maximum_visible_links - 1); |
550 | + $index = this.$el.find('li').eq(maximum_visible_links - 1); |
551 | $index.after($more); |
552 | //$('.oe_topbar').append($more); |
553 | $more.find('.oe_menu_more').append($index.next().nextAll()); |
554 | @@ -752,19 +752,19 @@ |
555 | */ |
556 | open_menu: function (id) { |
557 | var $clicked_menu, $sub_menu, $main_menu; |
558 | - $clicked_menu = this.$element.add(this.$secondary_menus).find('a[data-menu=' + id + ']'); |
559 | + $clicked_menu = this.$el.add(this.$secondary_menus).find('a[data-menu=' + id + ']'); |
560 | this.trigger('open_menu', id, $clicked_menu); |
561 | |
562 | if (this.$secondary_menus.has($clicked_menu).length) { |
563 | $sub_menu = $clicked_menu.parents('.oe_secondary_menu'); |
564 | - $main_menu = this.$element.find('a[data-menu=' + $sub_menu.data('menu-parent') + ']'); |
565 | + $main_menu = this.$el.find('a[data-menu=' + $sub_menu.data('menu-parent') + ']'); |
566 | } else { |
567 | $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + $clicked_menu.attr('data-menu') + ']'); |
568 | $main_menu = $clicked_menu; |
569 | } |
570 | |
571 | // Activate current main menu |
572 | - this.$element.find('.oe_active').removeClass('oe_active'); |
573 | + this.$el.find('.oe_active').removeClass('oe_active'); |
574 | $main_menu.addClass('oe_active'); |
575 | |
576 | // Show current sub menu |
577 | @@ -791,7 +791,7 @@ |
578 | * @param {Number} id the action_id to match |
579 | */ |
580 | open_action: function (id) { |
581 | - var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]'); |
582 | + var $menu = this.$el.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]'); |
583 | var menu_id = $menu.data('menu'); |
584 | if (menu_id) { |
585 | this.open_menu(menu_id); |
586 | @@ -807,14 +807,14 @@ |
587 | if (!id) { return; } |
588 | |
589 | // find back the menuitem in dom to get the action |
590 | - var $item = this.$element.find('a[data-menu=' + id + ']'); |
591 | + var $item = this.$el.find('a[data-menu=' + id + ']'); |
592 | if (!$item.length) { |
593 | $item = this.$secondary_menus.find('a[data-menu=' + id + ']'); |
594 | } |
595 | var action_id = $item.data('action-id'); |
596 | // If first level menu doesnt have action trigger first leaf |
597 | if (!action_id) { |
598 | - if(this.$element.has($item).length) { |
599 | + if(this.$el.has($item).length) { |
600 | var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']'); |
601 | var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]'); |
602 | if($items.length) { |
603 | @@ -855,7 +855,7 @@ |
604 | start: function() { |
605 | var self = this; |
606 | this._super.apply(this, arguments); |
607 | - this.$element.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) { |
608 | + this.$el.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) { |
609 | ev.preventDefault(); |
610 | var f = self['on_menu_' + $(this).data('menu')]; |
611 | if (f) { |
612 | @@ -866,7 +866,7 @@ |
613 | do_update: function () { |
614 | var self = this; |
615 | var fct = function() { |
616 | - var $avatar = self.$element.find('.oe_topbar_avatar'); |
617 | + var $avatar = self.$el.find('.oe_topbar_avatar'); |
618 | $avatar.attr('src', $avatar.data('default-src')); |
619 | if (!self.session.uid) |
620 | return; |
621 | @@ -877,7 +877,7 @@ |
622 | topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db); |
623 | if(res.company_id[0] > 1) |
624 | topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]); |
625 | - self.$element.find('.oe_topbar_name').text(topbar_name); |
626 | + self.$el.find('.oe_topbar_name').text(topbar_name); |
627 | var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=image_small&id=%s', self.session.prefix, self.session.session_id, self.session.uid); |
628 | $avatar.attr('src', avatar_src); |
629 | }); |
630 | @@ -927,10 +927,10 @@ |
631 | }, |
632 | bind_events: function() { |
633 | var self = this; |
634 | - this.$element.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() { |
635 | + this.$el.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() { |
636 | $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter'); |
637 | }); |
638 | - this.$element.on('click', '.oe_dropdown_toggle', function(ev) { |
639 | + this.$el.on('click', '.oe_dropdown_toggle', function(ev) { |
640 | ev.preventDefault(); |
641 | var $toggle = $(this); |
642 | var $menu = $toggle.siblings('.oe_dropdown_menu'); |
643 | @@ -954,7 +954,7 @@ |
644 | instance.web.bus.on('click', this, function(ev) { |
645 | $.fn.tipsy.clear(); |
646 | if (!$(ev.target).is('input[type=file]')) { |
647 | - self.$element.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened'); |
648 | + self.$el.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened'); |
649 | } |
650 | }); |
651 | }, |
652 | @@ -963,9 +963,9 @@ |
653 | this.crashmanager = new instance.web.CrashManager(); |
654 | instance.session.on_rpc_error.add(this.crashmanager.on_rpc_error); |
655 | self.notification = new instance.web.Notification(this); |
656 | - self.notification.appendTo(self.$element); |
657 | + self.notification.appendTo(self.$el); |
658 | self.loading = new instance.web.Loading(self); |
659 | - self.loading.appendTo(self.$element); |
660 | + self.loading.appendTo(self.$el); |
661 | self.action_manager = new instance.web.ActionManager(self); |
662 | self.action_manager.appendTo(self.$('.oe_application')); |
663 | }, |
664 | @@ -1035,17 +1035,17 @@ |
665 | var self = this; |
666 | self.toggle_bars(true); |
667 | self.menu = new instance.web.Menu(self); |
668 | - self.menu.replace(this.$element.find('.oe_menu_placeholder')); |
669 | + self.menu.replace(this.$el.find('.oe_menu_placeholder')); |
670 | self.menu.on('menu_click', this, this.on_menu_action); |
671 | self.user_menu = new instance.web.UserMenu(self); |
672 | - self.user_menu.replace(this.$element.find('.oe_user_menu_placeholder')); |
673 | + self.user_menu.replace(this.$el.find('.oe_user_menu_placeholder')); |
674 | self.user_menu.on_menu_logout.add(this.proxy('on_logout')); |
675 | self.user_menu.on_action.add(this.proxy('on_menu_action')); |
676 | self.user_menu.do_update(); |
677 | self.bind_hashchange(); |
678 | if (!self.session.openerp_entreprise) { |
679 | var version_label = _t("OpenERP - Unsupported/Community Version"); |
680 | - self.$element.find('.oe_footer_powered').append(_.str.sprintf('<span> - <a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">%s</a></span>', version_label)); |
681 | + self.$el.find('.oe_footer_powered').append(_.str.sprintf('<span> - <a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">%s</a></span>', version_label)); |
682 | } |
683 | self.set_title(); |
684 | }, |
685 | @@ -1053,7 +1053,7 @@ |
686 | _.each(_.clone(this.getChildren()), function(el) { |
687 | el.destroy(); |
688 | }); |
689 | - this.$element.children().remove(); |
690 | + this.$el.children().remove(); |
691 | }, |
692 | do_reload: function() { |
693 | var self = this; |
694 | @@ -1085,7 +1085,7 @@ |
695 | var state = $.bbq.getState(true); |
696 | if (_.isEmpty(state) || state.action == "login") { |
697 | self.menu.has_been_loaded.then(function() { |
698 | - var first_menu_id = self.menu.$element.find("a:first").data("menu"); |
699 | + var first_menu_id = self.menu.$el.find("a:first").data("menu"); |
700 | if(first_menu_id) { |
701 | self.menu.menu_click(first_menu_id); |
702 | } |
703 | @@ -1140,10 +1140,10 @@ |
704 | }, |
705 | set_content_full_screen: function(fullscreen) { |
706 | if (fullscreen) { |
707 | - $(".oe_webclient", this.$element).addClass("oe_content_full_screen"); |
708 | + $(".oe_webclient", this.$el).addClass("oe_content_full_screen"); |
709 | $("body").css({'overflow-y':'hidden'}); |
710 | } else { |
711 | - $(".oe_webclient", this.$element).removeClass("oe_content_full_screen"); |
712 | + $(".oe_webclient", this.$el).removeClass("oe_content_full_screen"); |
713 | $("body").css({'overflow-y':'scroll'}); |
714 | } |
715 | } |
716 | |
717 | === modified file 'addons/web/static/src/js/corelib.js' |
718 | --- addons/web/static/src/js/corelib.js 2012-08-14 15:29:00 +0000 |
719 | +++ addons/web/static/src/js/corelib.js 2012-08-27 06:09:20 +0000 |
720 | @@ -525,8 +525,8 @@ |
721 | _.each(this.getChildren(), function(el) { |
722 | el.destroy(); |
723 | }); |
724 | - if(this.$element) { |
725 | - this.$element.remove(); |
726 | + if(this.$el) { |
727 | + this.$el.remove(); |
728 | } |
729 | instance.web.PropertiesMixin.destroy.call(this); |
730 | }, |
731 | @@ -538,7 +538,7 @@ |
732 | appendTo: function(target) { |
733 | var self = this; |
734 | return this.__widgetRenderAndInsert(function(t) { |
735 | - self.$element.appendTo(t); |
736 | + self.$el.appendTo(t); |
737 | }, target); |
738 | }, |
739 | /** |
740 | @@ -549,7 +549,7 @@ |
741 | prependTo: function(target) { |
742 | var self = this; |
743 | return this.__widgetRenderAndInsert(function(t) { |
744 | - self.$element.prependTo(t); |
745 | + self.$el.prependTo(t); |
746 | }, target); |
747 | }, |
748 | /** |
749 | @@ -560,7 +560,7 @@ |
750 | insertAfter: function(target) { |
751 | var self = this; |
752 | return this.__widgetRenderAndInsert(function(t) { |
753 | - self.$element.insertAfter(t); |
754 | + self.$el.insertAfter(t); |
755 | }, target); |
756 | }, |
757 | /** |
758 | @@ -571,7 +571,7 @@ |
759 | insertBefore: function(target) { |
760 | var self = this; |
761 | return this.__widgetRenderAndInsert(function(t) { |
762 | - self.$element.insertBefore(t); |
763 | + self.$el.insertBefore(t); |
764 | }, target); |
765 | }, |
766 | /** |
767 | @@ -581,7 +581,7 @@ |
768 | */ |
769 | replace: function(target) { |
770 | return this.__widgetRenderAndInsert(_.bind(function(t) { |
771 | - this.$element.replaceAll(t); |
772 | + this.$el.replaceAll(t); |
773 | }, this), target); |
774 | }, |
775 | __widgetRenderAndInsert: function(insertion, target) { |
776 | @@ -640,8 +640,8 @@ |
777 | * // stuff that you want to init before the rendering |
778 | * }, |
779 | * start: function() { |
780 | - * // stuff you want to make after the rendering, `this.$element` holds a correct value |
781 | - * this.$element.find(".my_button").click(/* an example of event binding * /); |
782 | + * // stuff you want to make after the rendering, `this.$el` holds a correct value |
783 | + * this.$el.find(".my_button").click(/* an example of event binding * /); |
784 | * |
785 | * // if you have some asynchronous operations, it's a good idea to return |
786 | * // a promise in start() |
787 | @@ -718,15 +718,15 @@ |
788 | * @returns {*} this |
789 | */ |
790 | replaceElement: function ($el) { |
791 | - var $oldel = this.$element; |
792 | + var $oldel = this.$el; |
793 | this.setElement($el); |
794 | - if ($oldel && !$oldel.is(this.$element)) { |
795 | - $oldel.replaceWith(this.$element); |
796 | + if ($oldel && !$oldel.is(this.$el)) { |
797 | + $oldel.replaceWith(this.$el); |
798 | } |
799 | return this; |
800 | }, |
801 | /** |
802 | - * Re-sets the widget's root element (el/$el/$element). |
803 | + * Re-sets the widget's root element (el/$el/$el). |
804 | * |
805 | * Includes: |
806 | * * re-delegating events |
807 | @@ -738,14 +738,14 @@ |
808 | * @return {*} this |
809 | */ |
810 | setElement: function (element) { |
811 | - // NB: completely useless, as WidgetMixin#init creates a $element |
812 | + // NB: completely useless, as WidgetMixin#init creates a $el |
813 | // always |
814 | - if (this.$element) { |
815 | + if (this.$el) { |
816 | this.undelegateEvents(); |
817 | } |
818 | |
819 | - this.$element = (element instanceof $) ? element : $(element); |
820 | - this.el = this.$element[0]; |
821 | + this.$el = (element instanceof $) ? element : $(element); |
822 | + this.el = this.$el[0]; |
823 | |
824 | this.delegateEvents(); |
825 | |
826 | @@ -797,23 +797,23 @@ |
827 | |
828 | event += '.widget_events'; |
829 | if (!selector) { |
830 | - this.$element.on(event, method); |
831 | + this.$el.on(event, method); |
832 | } else { |
833 | - this.$element.on(event, selector, method); |
834 | + this.$el.on(event, selector, method); |
835 | } |
836 | } |
837 | }, |
838 | undelegateEvents: function () { |
839 | - this.$element.off('.widget_events'); |
840 | + this.$el.off('.widget_events'); |
841 | }, |
842 | /** |
843 | - * Shortcut for ``this.$element.find(selector)`` |
844 | + * Shortcut for ``this.$el.find(selector)`` |
845 | * |
846 | * @param {String} selector CSS selector, rooted in $el |
847 | * @returns {jQuery} selector match |
848 | */ |
849 | $: function(selector) { |
850 | - return this.$element.find(selector); |
851 | + return this.$el.find(selector); |
852 | }, |
853 | /** |
854 | * Informs the action manager to do an action. This supposes that |
855 | |
856 | === modified file 'addons/web/static/src/js/coresetup.js' |
857 | --- addons/web/static/src/js/coresetup.js 2012-08-21 09:30:00 +0000 |
858 | +++ addons/web/static/src/js/coresetup.js 2012-08-27 06:09:20 +0000 |
859 | @@ -520,82 +520,6 @@ |
860 | return old_async_when.apply(this, arguments); |
861 | }; |
862 | |
863 | -/** Setup blockui */ |
864 | -if ($.blockUI) { |
865 | - $.blockUI.defaults.baseZ = 1100; |
866 | - $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">'; |
867 | - $.blockUI.defaults.css.border = '0'; |
868 | - $.blockUI.defaults.css["background-color"] = ''; |
869 | -} |
870 | - |
871 | -var messages_by_seconds = [ |
872 | - [0, "Loading..."], |
873 | - [30, "Still Loading..."], |
874 | - [60, "Still Loading...<br />Please be patient."], |
875 | - [120, "Hey, guess what?<br />It's still loading."], |
876 | - [300, "You may not believe it,<br/>but the application is actually loading..."], |
877 | -]; |
878 | - |
879 | -instance.web.Throbber = instance.web.Widget.extend({ |
880 | - template: "Throbber", |
881 | - start: function() { |
882 | - var opts = { |
883 | - lines: 13, // The number of lines to draw |
884 | - length: 7, // The length of each line |
885 | - width: 4, // The line thickness |
886 | - radius: 10, // The radius of the inner circle |
887 | - rotate: 0, // The rotation offset |
888 | - color: '#FFF', // #rgb or #rrggbb |
889 | - speed: 1, // Rounds per second |
890 | - trail: 60, // Afterglow percentage |
891 | - shadow: false, // Whether to render a shadow |
892 | - hwaccel: false, // Whether to use hardware acceleration |
893 | - className: 'spinner', // The CSS class to assign to the spinner |
894 | - zIndex: 2e9, // The z-index (defaults to 2000000000) |
895 | - top: 'auto', // Top position relative to parent in px |
896 | - left: 'auto' // Left position relative to parent in px |
897 | - }; |
898 | - this.spin = new Spinner(opts).spin(this.$element[0]); |
899 | - this.start_time = new Date().getTime(); |
900 | - this.act_message(); |
901 | - }, |
902 | - act_message: function() { |
903 | - var self = this; |
904 | - setTimeout(function() { |
905 | - if (self.isDestroyed()) |
906 | - return; |
907 | - var seconds = (new Date().getTime() - self.start_time) / 1000; |
908 | - var mes; |
909 | - _.each(messages_by_seconds, function(el) { |
910 | - if (seconds >= el[0]) |
911 | - mes = el[1]; |
912 | - }); |
913 | - self.$(".oe_throbber_message").html(mes); |
914 | - self.act_message(); |
915 | - }, 1000); |
916 | - }, |
917 | - destroy: function() { |
918 | - if (this.spin) |
919 | - this.spin.stop(); |
920 | - this._super(); |
921 | - }, |
922 | -}); |
923 | -instance.web.Throbber.throbbers = []; |
924 | - |
925 | -instance.web.blockUI = function() { |
926 | - var tmp = $.blockUI.apply($, arguments); |
927 | - var throbber = new instance.web.Throbber(); |
928 | - instance.web.Throbber.throbbers.push(throbber); |
929 | - throbber.appendTo($(".oe_blockui_spin_container")); |
930 | - return tmp; |
931 | -} |
932 | -instance.web.unblockUI = function() { |
933 | - _.each(instance.web.Throbber.throbbers, function(el) { |
934 | - el.destroy(); |
935 | - }); |
936 | - return $.unblockUI.apply($, arguments); |
937 | -} |
938 | - |
939 | /** Setup default session */ |
940 | instance.session = new instance.web.Session(); |
941 | |
942 | @@ -679,6 +603,86 @@ |
943 | $.timeago.settings.translator = instance.web._t; |
944 | }); |
945 | |
946 | +/** Setup blockui */ |
947 | +if ($.blockUI) { |
948 | + $.blockUI.defaults.baseZ = 1100; |
949 | + $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">'; |
950 | + $.blockUI.defaults.css.border = '0'; |
951 | + $.blockUI.defaults.css["background-color"] = ''; |
952 | +} |
953 | + |
954 | +var messages_by_seconds = function() { |
955 | + return [ |
956 | + [0, _t("Loading...")], |
957 | + [30, _t("Still loading...")], |
958 | + [60, _t("Still loading...<br />Please be patient.")], |
959 | + [120, _t("Don't leave yet,<br />it's still loading...")], |
960 | + [300, _t("You may not believe it,<br />but the application is actually loading...")], |
961 | + [600, _t("You know, sometimes,<br />OpenERP can be a little bit slow,<br />because it's loading...")], |
962 | + [3600, _t("Maybe you should consider pressing F5...")], |
963 | + ]; |
964 | +}; |
965 | + |
966 | +instance.web.Throbber = instance.web.Widget.extend({ |
967 | + template: "Throbber", |
968 | + start: function() { |
969 | + var opts = { |
970 | + lines: 13, // The number of lines to draw |
971 | + length: 7, // The length of each line |
972 | + width: 4, // The line thickness |
973 | + radius: 10, // The radius of the inner circle |
974 | + rotate: 0, // The rotation offset |
975 | + color: '#FFF', // #rgb or #rrggbb |
976 | + speed: 1, // Rounds per second |
977 | + trail: 60, // Afterglow percentage |
978 | + shadow: false, // Whether to render a shadow |
979 | + hwaccel: false, // Whether to use hardware acceleration |
980 | + className: 'spinner', // The CSS class to assign to the spinner |
981 | + zIndex: 2e9, // The z-index (defaults to 2000000000) |
982 | + top: 'auto', // Top position relative to parent in px |
983 | + left: 'auto' // Left position relative to parent in px |
984 | + }; |
985 | + this.spin = new Spinner(opts).spin(this.$el[0]); |
986 | + this.start_time = new Date().getTime(); |
987 | + this.act_message(); |
988 | + }, |
989 | + act_message: function() { |
990 | + var self = this; |
991 | + setTimeout(function() { |
992 | + if (self.isDestroyed()) |
993 | + return; |
994 | + var seconds = (new Date().getTime() - self.start_time) / 1000; |
995 | + var mes; |
996 | + _.each(messages_by_seconds(), function(el) { |
997 | + if (seconds >= el[0]) |
998 | + mes = el[1]; |
999 | + }); |
1000 | + self.$(".oe_throbber_message").html(mes); |
1001 | + self.act_message(); |
1002 | + }, 1000); |
1003 | + }, |
1004 | + destroy: function() { |
1005 | + if (this.spin) |
1006 | + this.spin.stop(); |
1007 | + this._super(); |
1008 | + }, |
1009 | +}); |
1010 | +instance.web.Throbber.throbbers = []; |
1011 | + |
1012 | +instance.web.blockUI = function() { |
1013 | + var tmp = $.blockUI.apply($, arguments); |
1014 | + var throbber = new instance.web.Throbber(); |
1015 | + instance.web.Throbber.throbbers.push(throbber); |
1016 | + throbber.appendTo($(".oe_blockui_spin_container")); |
1017 | + return tmp; |
1018 | +} |
1019 | +instance.web.unblockUI = function() { |
1020 | + _.each(instance.web.Throbber.throbbers, function(el) { |
1021 | + el.destroy(); |
1022 | + }); |
1023 | + return $.unblockUI.apply($, arguments); |
1024 | +} |
1025 | + |
1026 | /** |
1027 | * Registry for all the client actions key: tag value: widget |
1028 | */ |
1029 | |
1030 | === modified file 'addons/web/static/src/js/data_export.js' |
1031 | --- addons/web/static/src/js/data_export.js 2012-07-24 14:12:20 +0000 |
1032 | +++ addons/web/static/src/js/data_export.js 2012-08-27 06:09:20 +0000 |
1033 | @@ -21,31 +21,31 @@ |
1034 | ], |
1035 | close: function(event, ui){ self.close();} |
1036 | }); |
1037 | - self.$element.removeClass('ui-dialog-content ui-widget-content'); |
1038 | - self.$element.find('#add_field').click(function() { |
1039 | + self.$el.removeClass('ui-dialog-content ui-widget-content'); |
1040 | + self.$el.find('#add_field').click(function() { |
1041 | if ($('#field-tree-structure tr.ui-selected')) { |
1042 | - var fld = self.$element.find('#field-tree-structure tr.ui-selected').find('a'); |
1043 | + var fld = self.$el.find('#field-tree-structure tr.ui-selected').find('a'); |
1044 | for (var i = 0; i < fld.length; i++) { |
1045 | var id = $(fld[i]).attr('id').split('-')[1]; |
1046 | var string = $(fld[i]).attr('string'); |
1047 | self.add_field(id, string); |
1048 | } |
1049 | - self.$element.find('#field-tree-structure tr').removeClass('ui-selected'); |
1050 | + self.$el.find('#field-tree-structure tr').removeClass('ui-selected'); |
1051 | } |
1052 | }); |
1053 | - self.$element.find('#remove_field').click(function() { |
1054 | - self.$element.find('#fields_list option:selected').remove(); |
1055 | - }); |
1056 | - self.$element.find('#remove_all_field').click(function() { |
1057 | - self.$element.find('#fields_list').empty(); |
1058 | - }); |
1059 | - this.$element.find('#export_new_list').click(this.on_show_save_list); |
1060 | + self.$el.find('#remove_field').click(function() { |
1061 | + self.$el.find('#fields_list option:selected').remove(); |
1062 | + }); |
1063 | + self.$el.find('#remove_all_field').click(function() { |
1064 | + self.$el.find('#fields_list').empty(); |
1065 | + }); |
1066 | + this.$el.find('#export_new_list').click(this.on_show_save_list); |
1067 | |
1068 | var got_fields = new $.Deferred(); |
1069 | - this.$element.find('#import_compat').change(function() { |
1070 | - self.$element.find('#fields_list').empty(); |
1071 | - self.$element.find('#field-tree-structure').remove(); |
1072 | - var import_comp = self.$element.find("#import_compat").val(); |
1073 | + this.$el.find('#import_compat').change(function() { |
1074 | + self.$el.find('#fields_list').empty(); |
1075 | + self.$el.find('#field-tree-structure').remove(); |
1076 | + var import_comp = self.$el.find("#import_compat").val(); |
1077 | self.rpc("/web/export/get_fields", { |
1078 | model: self.dataset.model, |
1079 | import_compat: Boolean(import_comp) |
1080 | @@ -61,7 +61,7 @@ |
1081 | this.show_exports_list()); |
1082 | }, |
1083 | do_setup_export_formats: function (formats) { |
1084 | - var $fmts = this.$element.find('#export_format'); |
1085 | + var $fmts = this.$el.find('#export_format'); |
1086 | _(formats).each(function (format) { |
1087 | var opt = new Option(format.label, format.tag); |
1088 | if (format.error) { |
1089 | @@ -76,8 +76,8 @@ |
1090 | }, |
1091 | show_exports_list: function() { |
1092 | var self = this; |
1093 | - if (self.$element.find('#saved_export_list').is(':hidden')) { |
1094 | - self.$element.find('#ExistsExportList').show(); |
1095 | + if (self.$el.find('#saved_export_list').is(':hidden')) { |
1096 | + self.$el.find('#ExistsExportList').show(); |
1097 | return; |
1098 | } |
1099 | return this.exports.read_slice(['name'], { |
1100 | @@ -86,35 +86,35 @@ |
1101 | if (!export_list.length) { |
1102 | return; |
1103 | } |
1104 | - self.$element.find('#ExistsExportList').append(QWeb.render('Exists.ExportList', {'existing_exports': export_list})); |
1105 | - self.$element.find('#saved_export_list').change(function() { |
1106 | - self.$element.find('#fields_list option').remove(); |
1107 | - var export_id = self.$element.find('#saved_export_list option:selected').val(); |
1108 | + self.$el.find('#ExistsExportList').append(QWeb.render('Exists.ExportList', {'existing_exports': export_list})); |
1109 | + self.$el.find('#saved_export_list').change(function() { |
1110 | + self.$el.find('#fields_list option').remove(); |
1111 | + var export_id = self.$el.find('#saved_export_list option:selected').val(); |
1112 | if (export_id) { |
1113 | self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}, self.do_load_export_field); |
1114 | } |
1115 | }); |
1116 | - self.$element.find('#delete_export_list').click(function() { |
1117 | - var select_exp = self.$element.find('#saved_export_list option:selected'); |
1118 | + self.$el.find('#delete_export_list').click(function() { |
1119 | + var select_exp = self.$el.find('#saved_export_list option:selected'); |
1120 | if (select_exp.val()) { |
1121 | self.exports.unlink([parseInt(select_exp.val(), 10)]); |
1122 | select_exp.remove(); |
1123 | - if (self.$element.find('#saved_export_list option').length <= 1) { |
1124 | - self.$element.find('#ExistsExportList').hide(); |
1125 | + if (self.$el.find('#saved_export_list option').length <= 1) { |
1126 | + self.$el.find('#ExistsExportList').hide(); |
1127 | } |
1128 | } |
1129 | }); |
1130 | }); |
1131 | }, |
1132 | do_load_export_field: function(field_list) { |
1133 | - var export_node = this.$element.find("#fields_list"); |
1134 | + var export_node = this.$el.find("#fields_list"); |
1135 | _(field_list).each(function (field) { |
1136 | export_node.append(new Option(field.label, field.name)); |
1137 | }); |
1138 | }, |
1139 | on_show_save_list: function() { |
1140 | var self = this; |
1141 | - var current_node = self.$element.find("#savenewlist"); |
1142 | + var current_node = self.$el.find("#savenewlist"); |
1143 | if (!(current_node.find("label")).length) { |
1144 | current_node.append(QWeb.render('ExportNewList')); |
1145 | current_node.find("#add_export_list").click(function() { |
1146 | @@ -150,14 +150,14 @@ |
1147 | if (!export_list_id.result) { |
1148 | return; |
1149 | } |
1150 | - self.$element.find("#saved_export_list").append( |
1151 | + self.$el.find("#saved_export_list").append( |
1152 | new Option(value, export_list_id.result)); |
1153 | - if (self.$element.find("#saved_export_list").is(":hidden")) { |
1154 | + if (self.$el.find("#saved_export_list").is(":hidden")) { |
1155 | self.show_exports_list(); |
1156 | } |
1157 | }); |
1158 | this.on_show_save_list(); |
1159 | - this.$element.find("#fields_list option").remove(); |
1160 | + this.$el.find("#fields_list option").remove(); |
1161 | }, |
1162 | on_click: function(id, record) { |
1163 | var self = this; |
1164 | @@ -173,7 +173,7 @@ |
1165 | } |
1166 | |
1167 | if (!record.loaded) { |
1168 | - var import_comp = self.$element.find("#import_compat").val(); |
1169 | + var import_comp = self.$el.find("#import_compat").val(); |
1170 | self.rpc("/web/export/get_fields", { |
1171 | model: model, |
1172 | prefix: prefix, |
1173 | @@ -191,44 +191,44 @@ |
1174 | }, |
1175 | on_show_data: function(result, after) { |
1176 | var self = this; |
1177 | - var imp_cmpt = Boolean(self.$element.find("#import_compat").val()); |
1178 | + var imp_cmpt = Boolean(self.$el.find("#import_compat").val()); |
1179 | |
1180 | if (after) { |
1181 | - var current_tr = self.$element.find("tr[id='treerow-" + after + "']"); |
1182 | + var current_tr = self.$el.find("tr[id='treerow-" + after + "']"); |
1183 | current_tr.addClass('open'); |
1184 | current_tr.find('img').attr('src','/web/static/src/img/collapse.gif'); |
1185 | current_tr.after(QWeb.render('ExportTreeView-Secondary.children', {'fields': result})); |
1186 | } else { |
1187 | - self.$element.find('#left_field_panel').append(QWeb.render('ExportTreeView-Secondary', {'fields': result})); |
1188 | + self.$el.find('#left_field_panel').append(QWeb.render('ExportTreeView-Secondary', {'fields': result})); |
1189 | } |
1190 | _.each(result, function(record) { |
1191 | self.records[record.id] = record.value; |
1192 | if (record.required) { |
1193 | - var required_fld = self.$element.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); |
1194 | + var required_fld = self.$el.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); |
1195 | required_fld.addClass("oe_export_requiredfield"); |
1196 | } |
1197 | - self.$element.find("img[id='parentimg-" + record.id +"']").click(function() { |
1198 | + self.$el.find("img[id='parentimg-" + record.id +"']").click(function() { |
1199 | self.on_click(this.id, record); |
1200 | }); |
1201 | |
1202 | - self.$element.find("tr[id='treerow-" + record.id + "']").click(function(e) { |
1203 | + self.$el.find("tr[id='treerow-" + record.id + "']").click(function(e) { |
1204 | if (e.shiftKey) { |
1205 | var frst_click, scnd_click = ''; |
1206 | if (self.row_index == 0) { |
1207 | self.row_index = this.rowIndex; |
1208 | - frst_click = self.$element.find("tr[id^='treerow-']")[self.row_index-1]; |
1209 | + frst_click = self.$el.find("tr[id^='treerow-']")[self.row_index-1]; |
1210 | $(frst_click).addClass("ui-selected"); |
1211 | } else { |
1212 | if (this.rowIndex >=self.row_index) { |
1213 | for (var i = (self.row_index-1); i < this.rowIndex; i++) { |
1214 | - scnd_click = self.$element.find("tr[id^='treerow-']")[i]; |
1215 | + scnd_click = self.$el.find("tr[id^='treerow-']")[i]; |
1216 | if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1217 | $(scnd_click).addClass("ui-selected"); |
1218 | } |
1219 | } |
1220 | } else { |
1221 | for (var i = (self.row_index-1); i >= (this.rowIndex-1); i--) { |
1222 | - scnd_click = self.$element.find("tr[id^='treerow-']")[i]; |
1223 | + scnd_click = self.$el.find("tr[id^='treerow-']")[i]; |
1224 | if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1225 | $(scnd_click).addClass("ui-selected"); |
1226 | } |
1227 | @@ -238,10 +238,10 @@ |
1228 | } |
1229 | self.row_index = this.rowIndex; |
1230 | |
1231 | - self.$element.find("tr[id='treerow-" + record.id + "']").keyup(function() { |
1232 | + self.$el.find("tr[id='treerow-" + record.id + "']").keyup(function() { |
1233 | self.row_index = 0; |
1234 | }); |
1235 | - var o2m_selection = self.$element.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); |
1236 | + var o2m_selection = self.$el.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); |
1237 | if ($(o2m_selection).hasClass("oe_export_readonlyfield")) { |
1238 | return false; |
1239 | } |
1240 | @@ -252,14 +252,14 @@ |
1241 | $(this).addClass('ui-selected').find('a').focus(); |
1242 | } |
1243 | } else if (!e.shiftKey) { |
1244 | - self.$element.find("tr.ui-selected") |
1245 | + self.$el.find("tr.ui-selected") |
1246 | .removeClass("ui-selected").find('a').blur(); |
1247 | $(this).addClass("ui-selected").find('a').focus(); |
1248 | } |
1249 | return false; |
1250 | }); |
1251 | |
1252 | - self.$element.find("tr[id='treerow-" + record.id + "']").keydown(function(e) { |
1253 | + self.$el.find("tr[id='treerow-" + record.id + "']").keydown(function(e) { |
1254 | var keyCode = e.keyCode || e.which; |
1255 | var arrow = {left: 37, up: 38, right: 39, down: 40 }; |
1256 | switch (keyCode) { |
1257 | @@ -297,19 +297,19 @@ |
1258 | break; |
1259 | } |
1260 | }); |
1261 | - self.$element.find("tr[id='treerow-" + record.id + "']").dblclick(function() { |
1262 | - var $o2m_selection = self.$element.find("tr[id^='treerow-" + record.id + "']").find('#tree-column'); |
1263 | + self.$el.find("tr[id='treerow-" + record.id + "']").dblclick(function() { |
1264 | + var $o2m_selection = self.$el.find("tr[id^='treerow-" + record.id + "']").find('#tree-column'); |
1265 | if (!$o2m_selection.hasClass("oe_export_readonlyfield")) { |
1266 | self.add_field(record.id, $(this).find("a").attr("string")); |
1267 | } |
1268 | }); |
1269 | }); |
1270 | - self.$element.find('#fields_list').mouseover(function(event) { |
1271 | + self.$el.find('#fields_list').mouseover(function(event) { |
1272 | if (event.relatedTarget) { |
1273 | if (event.relatedTarget.attributes['id'] && event.relatedTarget.attributes['string']) { |
1274 | var field_id = event.relatedTarget.attributes["id"]["value"]; |
1275 | if (field_id && field_id.split("-")[0] === 'export') { |
1276 | - if (!self.$element.find("tr[id='treerow-" + field_id.split("-")[1] + "']").find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1277 | + if (!self.$el.find("tr[id='treerow-" + field_id.split("-")[1] + "']").find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1278 | self.add_field(field_id.split("-")[1], event.relatedTarget.attributes["string"]["value"]); |
1279 | } |
1280 | } |
1281 | @@ -319,7 +319,7 @@ |
1282 | }, |
1283 | showcontent: function(id) { |
1284 | // show & hide the contents |
1285 | - var $this = this.$element.find("tr[id='treerow-" + id + "']"); |
1286 | + var $this = this.$el.find("tr[id='treerow-" + id + "']"); |
1287 | var is_open = $this.hasClass('open'); |
1288 | $this.toggleClass('open'); |
1289 | |
1290 | @@ -329,7 +329,7 @@ |
1291 | } else { |
1292 | first_child.attr('src', '/web/static/src/img/collapse.gif'); |
1293 | } |
1294 | - var child_field = this.$element.find("tr[id^='treerow-" + id +"/']"); |
1295 | + var child_field = this.$el.find("tr[id^='treerow-" + id +"/']"); |
1296 | var child_len = (id.split("/")).length + 1; |
1297 | for (var i = 0; i < child_field.length; i++) { |
1298 | var $child = $(child_field[i]); |
1299 | @@ -345,15 +345,15 @@ |
1300 | } |
1301 | }, |
1302 | add_field: function(field_id, string) { |
1303 | - var field_list = this.$element.find('#fields_list'); |
1304 | - if (this.$element.find("#fields_list option[value='" + field_id + "']") |
1305 | - && !this.$element.find("#fields_list option[value='" + field_id + "']").length) { |
1306 | + var field_list = this.$el.find('#fields_list'); |
1307 | + if (this.$el.find("#fields_list option[value='" + field_id + "']") |
1308 | + && !this.$el.find("#fields_list option[value='" + field_id + "']").length) { |
1309 | field_list.append(new Option(string, field_id)); |
1310 | } |
1311 | }, |
1312 | get_fields: function() { |
1313 | var export_field = []; |
1314 | - this.$element.find("#fields_list option").each(function() { |
1315 | + this.$el.find("#fields_list option").each(function() { |
1316 | export_field.push($(this).val()); |
1317 | }); |
1318 | if (!export_field.length) { |
1319 | @@ -363,7 +363,7 @@ |
1320 | }, |
1321 | on_click_export_data: function() { |
1322 | var self = this; |
1323 | - var exported_fields = this.$element.find('#fields_list option').map(function () { |
1324 | + var exported_fields = this.$el.find('#fields_list option').map(function () { |
1325 | // DOM property is textContent, but IE8 only knows innerText |
1326 | return {name: self.records[this.value] || this.value, |
1327 | label: this.textContent || this.innerText}; |
1328 | @@ -375,7 +375,7 @@ |
1329 | } |
1330 | |
1331 | exported_fields.unshift({name: 'id', label: 'External ID'}); |
1332 | - var export_format = this.$element.find("#export_format").val(); |
1333 | + var export_format = this.$el.find("#export_format").val(); |
1334 | instance.web.blockUI(); |
1335 | this.session.get_file({ |
1336 | url: '/web/export/' + export_format, |
1337 | @@ -385,13 +385,13 @@ |
1338 | ids: this.dataset.ids, |
1339 | domain: this.dataset.domain, |
1340 | import_compat: Boolean( |
1341 | - this.$element.find("#import_compat").val()) |
1342 | + this.$el.find("#import_compat").val()) |
1343 | })}, |
1344 | complete: instance.web.unblockUI |
1345 | }); |
1346 | }, |
1347 | close: function() { |
1348 | - this.$element.remove(); |
1349 | + this.$el.remove(); |
1350 | this._super(); |
1351 | } |
1352 | }); |
1353 | |
1354 | === modified file 'addons/web/static/src/js/data_import.js' |
1355 | --- addons/web/static/src/js/data_import.js 2012-08-02 14:46:23 +0000 |
1356 | +++ addons/web/static/src/js/data_import.js 2012-08-27 06:09:20 +0000 |
1357 | @@ -75,9 +75,9 @@ |
1358 | } |
1359 | }); |
1360 | this.toggle_import_button(false); |
1361 | - this.$element.find('#csvfile').change(this.on_autodetect_data); |
1362 | - this.$element.find('fieldset').change(this.on_autodetect_data); |
1363 | - this.$element.delegate('fieldset legend', 'click', function() { |
1364 | + this.$el.find('#csvfile').change(this.on_autodetect_data); |
1365 | + this.$el.find('fieldset').change(this.on_autodetect_data); |
1366 | + this.$el.delegate('fieldset legend', 'click', function() { |
1367 | $(this).parent().toggleClass('oe_closed'); |
1368 | }); |
1369 | this.ready.push(new instance.web.DataSet(this, this.model).call( |
1370 | @@ -156,19 +156,19 @@ |
1371 | }); |
1372 | }, |
1373 | toggle_import_button: function (newstate) { |
1374 | - instance.web.dialog(this.$element, 'widget') |
1375 | + instance.web.dialog(this.$el, 'widget') |
1376 | .find('.oe_import_dialog_button') |
1377 | .button('option', 'disabled', !newstate); |
1378 | }, |
1379 | do_import: function() { |
1380 | - if(!this.$element.find('#csvfile').val()) { return; } |
1381 | - var lines_to_skip = parseInt(this.$element.find('#csv_skip').val(), 10); |
1382 | - var with_headers = this.$element.find('#file_has_headers').prop('checked'); |
1383 | + if(!this.$el.find('#csvfile').val()) { return; } |
1384 | + var lines_to_skip = parseInt(this.$el.find('#csv_skip').val(), 10); |
1385 | + var with_headers = this.$el.find('#file_has_headers').prop('checked'); |
1386 | if (!lines_to_skip && with_headers) { |
1387 | lines_to_skip = 1; |
1388 | } |
1389 | var indices = [], fields = []; |
1390 | - this.$element.find(".sel_fields").each(function(index, element) { |
1391 | + this.$el.find(".sel_fields").each(function(index, element) { |
1392 | var val = element.value; |
1393 | if (!val) { |
1394 | return; |
1395 | @@ -177,7 +177,7 @@ |
1396 | fields.push(val); |
1397 | }); |
1398 | |
1399 | - jsonp(this.$element.find('#import_data'), { |
1400 | + jsonp(this.$el.find('#import_data'), { |
1401 | url: '/web/import/import_data', |
1402 | data: { |
1403 | model: this.model, |
1404 | @@ -190,19 +190,19 @@ |
1405 | }, this.on_import_results); |
1406 | }, |
1407 | on_autodetect_data: function() { |
1408 | - if(!this.$element.find('#csvfile').val()) { return; } |
1409 | - jsonp(this.$element.find('#import_data'), { |
1410 | + if(!this.$el.find('#csvfile').val()) { return; } |
1411 | + jsonp(this.$el.find('#import_data'), { |
1412 | url: '/web/import/detect_data' |
1413 | }, this.on_import_results); |
1414 | }, |
1415 | on_import_results: function(results) { |
1416 | - this.$element.find('#result').empty(); |
1417 | - var headers, result_node = this.$element.find("#result"); |
1418 | + this.$el.find('#result').empty(); |
1419 | + var headers, result_node = this.$el.find("#result"); |
1420 | |
1421 | if (results['error']) { |
1422 | result_node.append(QWeb.render('ImportView.error', { |
1423 | 'error': results['error']})); |
1424 | - this.$element.find('fieldset').removeClass('oe_closed'); |
1425 | + this.$el.find('fieldset').removeClass('oe_closed'); |
1426 | return; |
1427 | } |
1428 | if (results['success']) { |
1429 | @@ -214,8 +214,8 @@ |
1430 | } |
1431 | |
1432 | if (results['records']) { |
1433 | - var lines_to_skip = parseInt(this.$element.find('#csv_skip').val(), 10), |
1434 | - with_headers = this.$element.find('#file_has_headers').prop('checked'); |
1435 | + var lines_to_skip = parseInt(this.$el.find('#csv_skip').val(), 10), |
1436 | + with_headers = this.$el.find('#file_has_headers').prop('checked'); |
1437 | headers = with_headers ? results.records[0] : null; |
1438 | |
1439 | result_node.append(QWeb.render('ImportView.result', { |
1440 | @@ -224,17 +224,17 @@ |
1441 | : with_headers ? results.records.slice(1) |
1442 | : results.records |
1443 | })); |
1444 | - this.$element.find('fieldset').addClass('oe_closed'); |
1445 | + this.$el.find('fieldset').addClass('oe_closed'); |
1446 | } |
1447 | - this.$element.find('form').removeClass('oe_import_no_result'); |
1448 | + this.$el.find('form').removeClass('oe_import_no_result'); |
1449 | |
1450 | - this.$element.delegate('.oe_m2o_drop_down_button', 'click', function () { |
1451 | + this.$el.delegate('.oe_m2o_drop_down_button', 'click', function () { |
1452 | $(this).prev('input').focus(); |
1453 | }); |
1454 | |
1455 | var self = this; |
1456 | this.ready.then(function () { |
1457 | - var $fields = self.$element.find('.sel_fields').bind('blur', function () { |
1458 | + var $fields = self.$el.find('.sel_fields').bind('blur', function () { |
1459 | if (this.value && !_(self.all_fields).contains(this.value)) { |
1460 | this.value = ''; |
1461 | } |
1462 | @@ -315,9 +315,9 @@ |
1463 | find_duplicate_fields: function() { |
1464 | // Maps values to DOM nodes, in order to discover duplicates |
1465 | var values = {}, duplicates = {}; |
1466 | - this.$element.find(".sel_fields").each(function(index, element) { |
1467 | + this.$el.find(".sel_fields").each(function(index, element) { |
1468 | var value = element.value; |
1469 | - var $element = $(element).removeClass('duplicate_fld'); |
1470 | + var $el = $(element).removeClass('duplicate_fld'); |
1471 | if (!value) { return; } |
1472 | |
1473 | if (!(value in values)) { |
1474 | @@ -329,13 +329,13 @@ |
1475 | } else { |
1476 | duplicates[value] = [same_valued_field, element]; |
1477 | } |
1478 | - $element.add(same_valued_field).addClass('duplicate_fld'); |
1479 | + $el.add(same_valued_field).addClass('duplicate_fld'); |
1480 | } |
1481 | }); |
1482 | return duplicates; |
1483 | }, |
1484 | on_check_field_values: function () { |
1485 | - this.$element.find("#message, #msg").remove(); |
1486 | + this.$el.find("#message, #msg").remove(); |
1487 | |
1488 | var required_valid = this.check_required(); |
1489 | |
1490 | @@ -343,7 +343,7 @@ |
1491 | if (_.isEmpty(duplicates)) { |
1492 | this.toggle_import_button(required_valid); |
1493 | } else { |
1494 | - var $err = $('<div id="msg" style="color: red;">'+_t("Destination fields should only be selected once, some fields are selected more than once:")+'</div>').insertBefore(this.$element.find('#result')); |
1495 | + var $err = $('<div id="msg" style="color: red;">'+_t("Destination fields should only be selected once, some fields are selected more than once:")+'</div>').insertBefore(this.$el.find('#result')); |
1496 | var $dupes = $('<dl>').appendTo($err); |
1497 | _(duplicates).each(function(elements, value) { |
1498 | $('<dt>').text(value).appendTo($dupes); |
1499 | @@ -372,7 +372,7 @@ |
1500 | return f.id; |
1501 | }; |
1502 | |
1503 | - var selected_fields = _(this.$element.find('.sel_fields').get()).chain() |
1504 | + var selected_fields = _(this.$el.find('.sel_fields').get()).chain() |
1505 | .pluck('value') |
1506 | .compact() |
1507 | .map(resolve_field_id) |
1508 | @@ -380,13 +380,13 @@ |
1509 | |
1510 | var missing_fields = _.difference(this.required_fields, selected_fields); |
1511 | if (missing_fields.length) { |
1512 | - this.$element.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>'); |
1513 | + this.$el.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>'); |
1514 | return false; |
1515 | } |
1516 | return true; |
1517 | }, |
1518 | destroy: function() { |
1519 | - this.$element.remove(); |
1520 | + this.$el.remove(); |
1521 | this._super(); |
1522 | } |
1523 | }); |
1524 | |
1525 | === modified file 'addons/web/static/src/js/search.js' |
1526 | --- addons/web/static/src/js/search.js 2012-08-14 15:29:00 +0000 |
1527 | +++ addons/web/static/src/js/search.js 2012-08-27 06:09:20 +0000 |
1528 | @@ -126,21 +126,21 @@ |
1529 | template: 'SearchView.InputView', |
1530 | start: function () { |
1531 | var p = this._super.apply(this, arguments); |
1532 | - this.$element.on('focus', this.proxy('onFocus')); |
1533 | - this.$element.on('blur', this.proxy('onBlur')); |
1534 | - this.$element.on('keydown', this.proxy('onKeydown')); |
1535 | + this.$el.on('focus', this.proxy('onFocus')); |
1536 | + this.$el.on('blur', this.proxy('onBlur')); |
1537 | + this.$el.on('keydown', this.proxy('onKeydown')); |
1538 | return p; |
1539 | }, |
1540 | onFocus: function () { |
1541 | this.trigger('focused', this); |
1542 | }, |
1543 | onBlur: function () { |
1544 | - this.$element.text(''); |
1545 | + this.$el.text(''); |
1546 | this.trigger('blurred', this); |
1547 | }, |
1548 | getSelection: function () { |
1549 | // get Text node |
1550 | - var root = this.$element[0].childNodes[0]; |
1551 | + var root = this.$el[0].childNodes[0]; |
1552 | if (!root || !root.textContent) { |
1553 | // if input does not have a child node, or the child node is an |
1554 | // empty string, then the selection can only be (0, 0) |
1555 | @@ -202,7 +202,7 @@ |
1556 | break; |
1557 | case $.ui.keyCode.RIGHT: |
1558 | sel = this.getSelection(); |
1559 | - var len = this.$element.text().length; |
1560 | + var len = this.$el.text().length; |
1561 | if (sel.start !== len || sel.start !== sel.end) { |
1562 | e.stopPropagation(); |
1563 | } |
1564 | @@ -223,17 +223,17 @@ |
1565 | }, |
1566 | start: function () { |
1567 | var self = this; |
1568 | - this.$element.on('focus', function () { self.trigger('focused', self); }); |
1569 | - this.$element.on('blur', function () { self.trigger('blurred', self); }); |
1570 | - this.$element.on('click', function (e) { |
1571 | + this.$el.on('focus', function () { self.trigger('focused', self); }); |
1572 | + this.$el.on('blur', function () { self.trigger('blurred', self); }); |
1573 | + this.$el.on('click', function (e) { |
1574 | if ($(e.target).is('.oe_facet_remove')) { |
1575 | self.model.destroy(); |
1576 | return false; |
1577 | } |
1578 | - self.$element.focus(); |
1579 | + self.$el.focus(); |
1580 | e.stopPropagation(); |
1581 | }); |
1582 | - this.$element.on('keydown', function (e) { |
1583 | + this.$el.on('keydown', function (e) { |
1584 | var keys = $.ui.keyCode; |
1585 | switch (e.which) { |
1586 | case keys.BACKSPACE: |
1587 | @@ -242,7 +242,7 @@ |
1588 | return false; |
1589 | } |
1590 | }); |
1591 | - var $e = self.$element.find('> span:last-child'); |
1592 | + var $e = self.$el.find('> span:last-child'); |
1593 | var q = $.when(this._super()); |
1594 | return q.pipe(function () { |
1595 | var values = self.model.values.map(function (value) { |
1596 | @@ -253,7 +253,7 @@ |
1597 | }); |
1598 | }, |
1599 | model_changed: function () { |
1600 | - this.$element.text(this.$element.text() + '*'); |
1601 | + this.$el.text(this.$el.text() + '*'); |
1602 | } |
1603 | }); |
1604 | my.FacetValueView = instance.web.Widget.extend({ |
1605 | @@ -268,7 +268,7 @@ |
1606 | this._super(); |
1607 | }, |
1608 | model_changed: function () { |
1609 | - this.$element.text(this.$element.text() + '*'); |
1610 | + this.$el.text(this.$el.text() + '*'); |
1611 | } |
1612 | }); |
1613 | |
1614 | @@ -313,7 +313,7 @@ |
1615 | .on('add change reset remove', this.proxy('renderFacets')); |
1616 | |
1617 | if (this.hidden) { |
1618 | - this.$element.hide(); |
1619 | + this.$el.hide(); |
1620 | } |
1621 | if (this.headless) { |
1622 | this.ready.resolve(); |
1623 | @@ -331,12 +331,12 @@ |
1624 | } |
1625 | |
1626 | // Launch a search on clicking the oe_searchview_search button |
1627 | - this.$element.on('click', 'button.oe_searchview_search', function (e) { |
1628 | + this.$el.on('click', 'button.oe_searchview_search', function (e) { |
1629 | e.stopImmediatePropagation(); |
1630 | self.do_search(); |
1631 | }); |
1632 | |
1633 | - this.$element.on('keydown', |
1634 | + this.$el.on('keydown', |
1635 | '.oe_searchview_input, .oe_searchview_facet', function (e) { |
1636 | switch(e.which) { |
1637 | case $.ui.keyCode.LEFT: |
1638 | @@ -350,31 +350,31 @@ |
1639 | } |
1640 | }); |
1641 | |
1642 | - this.$element.on('click', '.oe_searchview_clear', function (e) { |
1643 | + this.$el.on('click', '.oe_searchview_clear', function (e) { |
1644 | e.stopImmediatePropagation(); |
1645 | self.query.reset(); |
1646 | }); |
1647 | - this.$element.on('click', '.oe_searchview_unfold_drawer', function (e) { |
1648 | + this.$el.on('click', '.oe_searchview_unfold_drawer', function (e) { |
1649 | e.stopImmediatePropagation(); |
1650 | - self.$element.toggleClass('oe_searchview_open_drawer'); |
1651 | + self.$el.toggleClass('oe_searchview_open_drawer'); |
1652 | }); |
1653 | instance.web.bus.on('click', this, function(ev) { |
1654 | if ($(ev.target).parents('.oe_searchview').length === 0) { |
1655 | - self.$element.removeClass('oe_searchview_open_drawer'); |
1656 | + self.$el.removeClass('oe_searchview_open_drawer'); |
1657 | } |
1658 | }); |
1659 | // Focus last input if the view itself is clicked (empty section of |
1660 | // facets element) |
1661 | - this.$element.on('click', function (e) { |
1662 | - if (e.target === self.$element.find('.oe_searchview_facets')[0]) { |
1663 | - self.$element.find('.oe_searchview_input:last').focus(); |
1664 | + this.$el.on('click', function (e) { |
1665 | + if (e.target === self.$el.find('.oe_searchview_facets')[0]) { |
1666 | + self.$el.find('.oe_searchview_input:last').focus(); |
1667 | } |
1668 | }); |
1669 | // when the completion list opens/refreshes, automatically select the |
1670 | // first completion item so if the user just hits [RETURN] or [TAB] it |
1671 | // automatically selects it |
1672 | - this.$element.on('autocompleteopen', function () { |
1673 | - var menu = self.$element.data('autocomplete').menu; |
1674 | + this.$el.on('autocompleteopen', function () { |
1675 | + var menu = self.$el.data('autocomplete').menu; |
1676 | menu.activate( |
1677 | $.Event({ type: "mouseenter" }), |
1678 | menu.element.children().first()); |
1679 | @@ -383,15 +383,15 @@ |
1680 | return $.when(p, this.ready); |
1681 | }, |
1682 | show: function () { |
1683 | - this.$element.show(); |
1684 | + this.$el.show(); |
1685 | }, |
1686 | hide: function () { |
1687 | - this.$element.hide(); |
1688 | + this.$el.hide(); |
1689 | }, |
1690 | |
1691 | subviewForRoot: function (subview_root) { |
1692 | return _(this.input_subviews).detect(function (subview) { |
1693 | - return subview.$element[0] === subview_root; |
1694 | + return subview.$el[0] === subview_root; |
1695 | }); |
1696 | }, |
1697 | siblingSubview: function (subview, direction, wrap_around) { |
1698 | @@ -406,12 +406,12 @@ |
1699 | focusPreceding: function (subview_root) { |
1700 | return this.siblingSubview( |
1701 | this.subviewForRoot(subview_root), -1, true) |
1702 | - .$element.focus(); |
1703 | + .$el.focus(); |
1704 | }, |
1705 | focusFollowing: function (subview_root) { |
1706 | return this.siblingSubview( |
1707 | this.subviewForRoot(subview_root), +1, true) |
1708 | - .$element.focus(); |
1709 | + .$el.focus(); |
1710 | }, |
1711 | |
1712 | /** |
1713 | @@ -430,19 +430,19 @@ |
1714 | |
1715 | // autocomplete only correctly handles being initialized on the actual |
1716 | // editable element (and only an element with a @value in 1.8 e.g. |
1717 | - // input or textarea), cheat by setting val() on $element |
1718 | - this.$element.on('keydown', function () { |
1719 | + // input or textarea), cheat by setting val() on $el |
1720 | + this.$el.on('keydown', function () { |
1721 | // keydown is triggered *before* the element's value is set, so |
1722 | // delay this. Pray that setTimeout are executed in FIFO (if they |
1723 | // have the same delay) as autocomplete uses the exact same trick. |
1724 | // FIXME: brittle as fuck |
1725 | setTimeout(function () { |
1726 | - self.$element.val(self.currentInputValue()); |
1727 | + self.$el.val(self.currentInputValue()); |
1728 | }, 0); |
1729 | |
1730 | }); |
1731 | |
1732 | - this.$element.autocomplete({ |
1733 | + this.$el.autocomplete({ |
1734 | source: this.proxy('complete_global_search'), |
1735 | select: this.proxy('select_completion'), |
1736 | focus: function (e) { e.preventDefault(); }, |
1737 | @@ -479,7 +479,7 @@ |
1738 | * div[contenteditable].oe_searchview_input) |
1739 | */ |
1740 | currentInputValue: function () { |
1741 | - return this.$element.find('div.oe_searchview_input:focus').text(); |
1742 | + return this.$el.find('div.oe_searchview_input:focus').text(); |
1743 | }, |
1744 | /** |
1745 | * Provide auto-completion result for req.term (an array to `resp`) |
1746 | @@ -509,22 +509,22 @@ |
1747 | |
1748 | var input_index = _(this.input_subviews).indexOf( |
1749 | this.subviewForRoot( |
1750 | - this.$element.find('div.oe_searchview_input:focus')[0])); |
1751 | + this.$el.find('div.oe_searchview_input:focus')[0])); |
1752 | this.query.add(ui.item.facet, {at: input_index / 2}); |
1753 | }, |
1754 | childFocused: function () { |
1755 | - this.$element.addClass('oe_focused'); |
1756 | + this.$el.addClass('oe_focused'); |
1757 | }, |
1758 | childBlurred: function () { |
1759 | - var val = this.$element.val(); |
1760 | - this.$element.val(''); |
1761 | - var complete = this.$element.data('autocomplete'); |
1762 | + var val = this.$el.val(); |
1763 | + this.$el.val(''); |
1764 | + var complete = this.$el.data('autocomplete'); |
1765 | if ((val && complete.term === undefined) || complete.previous !== undefined) { |
1766 | throw new Error("new jquery.ui version altering implementation" + |
1767 | " details relied on"); |
1768 | } |
1769 | delete complete.term; |
1770 | - this.$element.removeClass('oe_focused') |
1771 | + this.$el.removeClass('oe_focused') |
1772 | .trigger('blur'); |
1773 | }, |
1774 | /** |
1775 | @@ -538,7 +538,7 @@ |
1776 | // _2: undefined if event=change, otherwise model |
1777 | var self = this; |
1778 | var started = []; |
1779 | - var $e = this.$element.find('div.oe_searchview_facets'); |
1780 | + var $e = this.$el.find('div.oe_searchview_facets'); |
1781 | _.invoke(this.input_subviews, 'destroy'); |
1782 | this.input_subviews = []; |
1783 | |
1784 | @@ -569,7 +569,7 @@ |
1785 | input_to_focus = self.input_subviews[(options.at + 1) * 2]; |
1786 | } |
1787 | |
1788 | - input_to_focus.$element.focus(); |
1789 | + input_to_focus.$el.focus(); |
1790 | }); |
1791 | }, |
1792 | |
1793 | @@ -664,7 +664,7 @@ |
1794 | // build drawer |
1795 | var drawer_started = $.when.apply( |
1796 | null, _(this.select_for_drawer()).invoke( |
1797 | - 'appendTo', this.$element.find('.oe_searchview_drawer'))); |
1798 | + 'appendTo', this.$el.find('.oe_searchview_drawer'))); |
1799 | |
1800 | // load defaults |
1801 | var defaults_fetched = $.when.apply(null, _(this.inputs).invoke( |
1802 | @@ -680,7 +680,7 @@ |
1803 | */ |
1804 | on_filters_management: function(e) { |
1805 | var self = this; |
1806 | - var select = this.$element.find(".oe_search-view-filters-management"); |
1807 | + var select = this.$el.find(".oe_search-view-filters-management"); |
1808 | var val = select.val(); |
1809 | switch(val) { |
1810 | case 'advanced_filter': |
1811 | @@ -989,7 +989,7 @@ |
1812 | this.view.query.on('add remove change reset', this.proxy('search_change')); |
1813 | }, |
1814 | start: function () { |
1815 | - this.$element.on('click', 'li', this.proxy('toggle_filter')); |
1816 | + this.$el.on('click', 'li', this.proxy('toggle_filter')); |
1817 | return $.when(null); |
1818 | }, |
1819 | /** |
1820 | @@ -998,7 +998,7 @@ |
1821 | */ |
1822 | search_change: function () { |
1823 | var self = this; |
1824 | - var $filters = this.$element.find('> li').removeClass('oe_selected'); |
1825 | + var $filters = this.$el.find('> li').removeClass('oe_selected'); |
1826 | var facet = this.view.query.find(_.bind(this.match_facet, this)); |
1827 | if (!facet) { return; } |
1828 | facet.values.each(function (v) { |
1829 | @@ -1299,17 +1299,17 @@ |
1830 | }); |
1831 | instance.web.search.NumberField = instance.web.search.Field.extend(/** @lends instance.web.search.NumberField# */{ |
1832 | value_from: function () { |
1833 | - if (!this.$element.val()) { |
1834 | + if (!this.$el.val()) { |
1835 | return null; |
1836 | } |
1837 | - var val = this.parse(this.$element.val()), |
1838 | - check = Number(this.$element.val()); |
1839 | + var val = this.parse(this.$el.val()), |
1840 | + check = Number(this.$el.val()); |
1841 | if (isNaN(val) || val !== check) { |
1842 | - this.$element.addClass('error'); |
1843 | + this.$el.addClass('error'); |
1844 | throw new instance.web.search.Invalid( |
1845 | - this.attrs.name, this.$element.val(), this.error_message); |
1846 | + this.attrs.name, this.$el.val(), this.error_message); |
1847 | } |
1848 | - this.$element.removeClass('error'); |
1849 | + this.$el.removeClass('error'); |
1850 | return val; |
1851 | } |
1852 | }); |
1853 | @@ -1542,9 +1542,9 @@ |
1854 | self.clear_selection(); |
1855 | }) |
1856 | .on('reset', this.proxy('clear_selection')); |
1857 | - this.$element.on('submit', 'form', this.proxy('save_current')); |
1858 | - this.$element.on('click', 'h4', function () { |
1859 | - self.$element.toggleClass('oe_opened'); |
1860 | + this.$el.on('submit', 'form', this.proxy('save_current')); |
1861 | + this.$el.on('click', 'h4', function () { |
1862 | + self.$el.toggleClass('oe_opened'); |
1863 | }); |
1864 | // FIXME: local eval of domain and context to get rid of special endpoint |
1865 | return this.rpc('/web/searchview/get_filters', { |
1866 | @@ -1552,7 +1552,7 @@ |
1867 | }).pipe(this.proxy('set_filters')); |
1868 | }, |
1869 | clear_selection: function () { |
1870 | - this.$element.find('li.oe_selected').removeClass('oe_selected'); |
1871 | + this.$el.find('li.oe_selected').removeClass('oe_selected'); |
1872 | }, |
1873 | append_filter: function (filter) { |
1874 | var self = this; |
1875 | @@ -1564,7 +1564,7 @@ |
1876 | } else { |
1877 | var id = filter.id; |
1878 | $filter = this.filters[key] = $('<li></li>') |
1879 | - .appendTo(this.$element.find('.oe_searchview_custom_list')) |
1880 | + .appendTo(this.$el.find('.oe_searchview_custom_list')) |
1881 | .addClass(filter.user_id ? 'oe_searchview_custom_private' |
1882 | : 'oe_searchview_custom_public') |
1883 | .text(filter.name); |
1884 | @@ -1599,8 +1599,8 @@ |
1885 | }, |
1886 | save_current: function () { |
1887 | var self = this; |
1888 | - var $name = this.$element.find('input:first'); |
1889 | - var private_filter = !this.$element.find('input:last').prop('checked'); |
1890 | + var $name = this.$el.find('input:first'); |
1891 | + var private_filter = !this.$el.find('input:last').prop('checked'); |
1892 | |
1893 | var search = this.view.build_search_data(); |
1894 | this.rpc('/web/session/eval_domain_and_context', { |
1895 | @@ -1622,7 +1622,7 @@ |
1896 | return self.model.call('create_or_replace', [filter]).then(function (id) { |
1897 | filter.id = id; |
1898 | self.append_filter(filter); |
1899 | - self.$element |
1900 | + self.$el |
1901 | .removeClass('oe_opened') |
1902 | .find('form')[0].reset(); |
1903 | }); |
1904 | @@ -1667,8 +1667,8 @@ |
1905 | } |
1906 | |
1907 | return $.when( |
1908 | - this.render_column(col1, $('<div>').appendTo(this.$element)), |
1909 | - this.render_column(col2, $('<div>').appendTo(this.$element))); |
1910 | + this.render_column(col1, $('<div>').appendTo(this.$el)), |
1911 | + this.render_column(col2, $('<div>').appendTo(this.$el))); |
1912 | }, |
1913 | render_column: function (column, $el) { |
1914 | return $.when.apply(null, _(column).map(function (group) { |
1915 | @@ -1684,10 +1684,10 @@ |
1916 | _in_drawer: true, |
1917 | start: function () { |
1918 | var self = this; |
1919 | - this.$element |
1920 | + this.$el |
1921 | .on('keypress keydown keyup', function (e) { e.stopPropagation(); }) |
1922 | .on('click', 'h4', function () { |
1923 | - self.$element.toggleClass('oe_opened'); |
1924 | + self.$el.toggleClass('oe_opened'); |
1925 | }).on('click', 'button.oe_add_condition', function () { |
1926 | self.append_proposition(); |
1927 | }).on('submit', 'form', function (e) { |
1928 | @@ -1706,7 +1706,7 @@ |
1929 | }, |
1930 | append_proposition: function () { |
1931 | return (new instance.web.search.ExtendedSearchProposition(this, this.fields)) |
1932 | - .appendTo(this.$element.find('ul')); |
1933 | + .appendTo(this.$el.find('ul')); |
1934 | }, |
1935 | commit_search: function () { |
1936 | var self = this; |
1937 | @@ -1733,7 +1733,7 @@ |
1938 | // add new empty proposition |
1939 | this.append_proposition(); |
1940 | // TODO: API on searchview |
1941 | - this.view.$element.removeClass('oe_searchview_open_drawer'); |
1942 | + this.view.$el.removeClass('oe_searchview_open_drawer'); |
1943 | } |
1944 | }); |
1945 | |
1946 | @@ -1757,16 +1757,16 @@ |
1947 | }, |
1948 | start: function () { |
1949 | var _this = this; |
1950 | - this.$element.find(".searchview_extended_prop_field").change(function() { |
1951 | + this.$el.find(".searchview_extended_prop_field").change(function() { |
1952 | _this.changed(); |
1953 | }); |
1954 | - this.$element.find('.searchview_extended_delete_prop').click(function () { |
1955 | + this.$el.find('.searchview_extended_delete_prop').click(function () { |
1956 | _this.destroy(); |
1957 | }); |
1958 | this.changed(); |
1959 | }, |
1960 | changed: function() { |
1961 | - var nval = this.$element.find(".searchview_extended_prop_field").val(); |
1962 | + var nval = this.$el.find(".searchview_extended_prop_field").val(); |
1963 | if(this.attrs.selected == null || nval != this.attrs.selected.name) { |
1964 | this.select_field(_.detect(this.fields, function(x) {return x.name == nval;})); |
1965 | } |
1966 | @@ -1781,7 +1781,7 @@ |
1967 | if(this.attrs.selected != null) { |
1968 | this.value.destroy(); |
1969 | this.value = null; |
1970 | - this.$element.find('.searchview_extended_prop_op').html(''); |
1971 | + this.$el.find('.searchview_extended_prop_op').html(''); |
1972 | } |
1973 | this.attrs.selected = field; |
1974 | if(field == null) { |
1975 | @@ -1797,9 +1797,9 @@ |
1976 | _.each(this.value.operators, function(operator) { |
1977 | $('<option>', {value: operator.value}) |
1978 | .text(String(operator.text)) |
1979 | - .appendTo(self.$element.find('.searchview_extended_prop_op')); |
1980 | + .appendTo(self.$el.find('.searchview_extended_prop_op')); |
1981 | }); |
1982 | - var $value_loc = this.$element.find('.searchview_extended_prop_value').empty(); |
1983 | + var $value_loc = this.$el.find('.searchview_extended_prop_value').empty(); |
1984 | this.value.appendTo($value_loc); |
1985 | |
1986 | }, |
1987 | @@ -1807,7 +1807,7 @@ |
1988 | if ( this.attrs.selected == null) |
1989 | return null; |
1990 | var field = this.attrs.selected; |
1991 | - var op = this.$element.find('.searchview_extended_prop_op')[0]; |
1992 | + var op = this.$el.find('.searchview_extended_prop_op')[0]; |
1993 | var operator = op.options[op.selectedIndex]; |
1994 | return { |
1995 | label: _.str.sprintf(_t('%(field)s %(operator)s "%(value)s"'), { |
1996 | @@ -1851,7 +1851,7 @@ |
1997 | {value: "!=", text: _lt("is not equal to")} |
1998 | ], |
1999 | get_value: function() { |
2000 | - return this.$element.val(); |
2001 | + return this.$el.val(); |
2002 | } |
2003 | }); |
2004 | instance.web.search.ExtendedSearchProposition.DateTime = instance.web.search.ExtendedSearchProposition.Field.extend({ |
2005 | @@ -1875,7 +1875,7 @@ |
2006 | start: function() { |
2007 | var ready = this._super(); |
2008 | this.datewidget = new (this.widget())(this); |
2009 | - this.datewidget.appendTo(this.$element); |
2010 | + this.datewidget.appendTo(this.$el); |
2011 | return ready; |
2012 | } |
2013 | }); |
2014 | @@ -1893,11 +1893,11 @@ |
2015 | {value: "<=", text: _lt("less or equal than")} |
2016 | ], |
2017 | toString: function () { |
2018 | - return this.$element.val(); |
2019 | + return this.$el.val(); |
2020 | }, |
2021 | get_value: function() { |
2022 | try { |
2023 | - return instance.web.parse_value(this.$element.val(), {'widget': 'integer'}); |
2024 | + return instance.web.parse_value(this.$el.val(), {'widget': 'integer'}); |
2025 | } catch (e) { |
2026 | return ""; |
2027 | } |
2028 | @@ -1917,11 +1917,11 @@ |
2029 | {value: "<=", text: _lt("less or equal than")} |
2030 | ], |
2031 | toString: function () { |
2032 | - return this.$element.val(); |
2033 | + return this.$el.val(); |
2034 | }, |
2035 | get_value: function() { |
2036 | try { |
2037 | - return instance.web.parse_value(this.$element.val(), {'widget': 'float'}); |
2038 | + return instance.web.parse_value(this.$el.val(), {'widget': 'float'}); |
2039 | } catch (e) { |
2040 | return ""; |
2041 | } |
2042 | @@ -1934,12 +1934,12 @@ |
2043 | {value: "!=", text: _lt("is not")} |
2044 | ], |
2045 | toString: function () { |
2046 | - var select = this.$element[0]; |
2047 | + var select = this.$el[0]; |
2048 | var option = select.options[select.selectedIndex]; |
2049 | return option.label || option.text; |
2050 | }, |
2051 | get_value: function() { |
2052 | - return this.$element.val(); |
2053 | + return this.$el.val(); |
2054 | } |
2055 | }); |
2056 | instance.web.search.ExtendedSearchProposition.Boolean = instance.web.search.ExtendedSearchProposition.Field.extend({ |
2057 | |
2058 | === modified file 'addons/web/static/src/js/view_form.js' |
2059 | --- addons/web/static/src/js/view_form.js 2012-08-23 15:37:10 +0000 |
2060 | +++ addons/web/static/src/js/view_form.js 2012-08-27 06:09:20 +0000 |
2061 | @@ -102,8 +102,8 @@ |
2062 | w.off('focused blurred'); |
2063 | w.destroy(); |
2064 | }); |
2065 | - if (this.$element) { |
2066 | - this.$element.off('.formBlur'); |
2067 | + if (this.$el) { |
2068 | + this.$el.off('.formBlur'); |
2069 | } |
2070 | this._super(); |
2071 | }, |
2072 | @@ -122,11 +122,11 @@ |
2073 | this.rendering_engine.set_tags_registry(this.tags_registry); |
2074 | if (!this.extract_qweb_template(data)) { |
2075 | this.rendering_engine.set_fields_view(data); |
2076 | - var $dest = this.$element.hasClass("oe_form_container") ? this.$element : this.$element.find('.oe_form_container'); |
2077 | + var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); |
2078 | this.rendering_engine.render_to($dest); |
2079 | } |
2080 | |
2081 | - this.$element.on('mousedown.formBlur', function () { |
2082 | + this.$el.on('mousedown.formBlur', function () { |
2083 | self.__clicked_inside = true; |
2084 | }); |
2085 | |
2086 | @@ -134,14 +134,14 @@ |
2087 | if (this.options.$buttons) { |
2088 | this.$buttons.appendTo(this.options.$buttons); |
2089 | } else { |
2090 | - this.$element.find('.oe_form_buttons').replaceWith(this.$buttons); |
2091 | + this.$el.find('.oe_form_buttons').replaceWith(this.$buttons); |
2092 | } |
2093 | this.$buttons.on('click','.oe_form_button_create',this.on_button_create); |
2094 | this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit); |
2095 | this.$buttons.on('click','.oe_form_button_save',this.on_button_save); |
2096 | this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel); |
2097 | |
2098 | - this.$sidebar = this.options.$sidebar || this.$element.find('.oe_form_sidebar'); |
2099 | + this.$sidebar = this.options.$sidebar || this.$el.find('.oe_form_sidebar'); |
2100 | if (!this.sidebar && this.options.$sidebar) { |
2101 | this.sidebar = new instance.web.Sidebar(this); |
2102 | this.sidebar.appendTo(this.$sidebar); |
2103 | @@ -158,7 +158,7 @@ |
2104 | this.has_been_loaded.resolve(); |
2105 | |
2106 | // Add bounce effect on button 'Edit' when click on readonly page view. |
2107 | - this.$element.find(".oe_form_field,label").on('click', function (e) { |
2108 | + this.$el.find(".oe_form_field,label").on('click', function (e) { |
2109 | if(self.get("actual_mode") == "view") { |
2110 | var $button = self.options.$buttons.find(".oe_form_button_edit"); |
2111 | $button.effect('bounce', {distance: 18, times: 5}, 150) |
2112 | @@ -215,7 +215,7 @@ |
2113 | this.default_focus_field = null; |
2114 | this.default_focus_button = null; |
2115 | this.translatable_fields = []; |
2116 | - this.$element.find('.oe_form_container').empty(); |
2117 | + this.$el.find('.oe_form_container').empty(); |
2118 | }, |
2119 | |
2120 | widgetFocused: function() { |
2121 | @@ -263,7 +263,7 @@ |
2122 | var self = this; |
2123 | options = options || {}; |
2124 | if (this.sidebar) { |
2125 | - this.sidebar.$element.show(); |
2126 | + this.sidebar.$el.show(); |
2127 | } |
2128 | if (this.$buttons) { |
2129 | this.$buttons.show(); |
2130 | @@ -271,11 +271,11 @@ |
2131 | if (this.$pager) { |
2132 | this.$pager.show(); |
2133 | } |
2134 | - this.$element.show().css({ |
2135 | + this.$el.show().css({ |
2136 | opacity: '0', |
2137 | filter: 'alpha(opacity = 0)' |
2138 | }); |
2139 | - this.$element.add(this.$buttons).removeClass('oe_form_dirty'); |
2140 | + this.$el.add(this.$buttons).removeClass('oe_form_dirty'); |
2141 | |
2142 | var shown = this.has_been_loaded; |
2143 | if (options.reload !== false) { |
2144 | @@ -293,7 +293,7 @@ |
2145 | } |
2146 | return shown.pipe(function() { |
2147 | self._actualize_mode(options.mode || self.options.initial_mode); |
2148 | - self.$element.css({ |
2149 | + self.$el.css({ |
2150 | opacity: '1', |
2151 | filter: 'alpha(opacity = 100)' |
2152 | }); |
2153 | @@ -301,7 +301,7 @@ |
2154 | }, |
2155 | do_hide: function () { |
2156 | if (this.sidebar) { |
2157 | - this.sidebar.$element.hide(); |
2158 | + this.sidebar.$el.hide(); |
2159 | } |
2160 | if (this.$buttons) { |
2161 | this.$buttons.hide(); |
2162 | @@ -325,7 +325,7 @@ |
2163 | if (this.qweb) { |
2164 | this.kill_current_form(); |
2165 | this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record)); |
2166 | - var $dest = this.$element.hasClass("oe_form_container") ? this.$element : this.$element.find('.oe_form_container'); |
2167 | + var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); |
2168 | this.rendering_engine.render_to($dest); |
2169 | } |
2170 | |
2171 | @@ -357,7 +357,7 @@ |
2172 | } else { |
2173 | self.do_push_state({}); |
2174 | } |
2175 | - self.$element.add(self.$buttons).removeClass('oe_form_dirty'); |
2176 | + self.$el.add(self.$buttons).removeClass('oe_form_dirty'); |
2177 | self.autofocus(); |
2178 | }); |
2179 | }, |
2180 | @@ -379,7 +379,7 @@ |
2181 | this.trigger("view_content_has_changed"); |
2182 | }, |
2183 | do_notify_change: function() { |
2184 | - this.$element.add(this.$buttons).addClass('oe_form_dirty'); |
2185 | + this.$el.add(this.$buttons).addClass('oe_form_dirty'); |
2186 | }, |
2187 | on_pager_action: function(action) { |
2188 | if (this.can_be_discarded()) { |
2189 | @@ -410,7 +410,7 @@ |
2190 | if (this.options.$pager) { |
2191 | this.$pager.appendTo(this.options.$pager); |
2192 | } else { |
2193 | - this.$element.find('.oe_form_pager').replaceWith(this.$pager); |
2194 | + this.$el.find('.oe_form_pager').replaceWith(this.$pager); |
2195 | } |
2196 | this.$pager.on('click','a[data-pager-action]',function() { |
2197 | var action = $(this).data('pager-action'); |
2198 | @@ -653,7 +653,7 @@ |
2199 | check_actual_mode: function(source, options) { |
2200 | var self = this; |
2201 | if(this.get("actual_mode") === "view") { |
2202 | - self.$element.removeClass('oe_form_editable').addClass('oe_form_readonly'); |
2203 | + self.$el.removeClass('oe_form_editable').addClass('oe_form_readonly'); |
2204 | self.$buttons.find('.oe_form_buttons_edit').hide(); |
2205 | self.$buttons.find('.oe_form_buttons_view').show(); |
2206 | self.$sidebar.show(); |
2207 | @@ -661,7 +661,7 @@ |
2208 | field.set({"force_readonly": true}); |
2209 | }); |
2210 | } else { |
2211 | - self.$element.removeClass('oe_form_readonly').addClass('oe_form_editable'); |
2212 | + self.$el.removeClass('oe_form_readonly').addClass('oe_form_editable'); |
2213 | self.$buttons.find('.oe_form_buttons_edit').show(); |
2214 | self.$buttons.find('.oe_form_buttons_view').hide(); |
2215 | self.$sidebar.hide(); |
2216 | @@ -752,7 +752,7 @@ |
2217 | return def.promise(); |
2218 | }, |
2219 | can_be_discarded: function() { |
2220 | - return !this.$element.is('.oe_form_dirty') || confirm(_t("Warning, the record has been modified, your changes will be discarded.")); |
2221 | + return !this.$el.is('.oe_form_dirty') || confirm(_t("Warning, the record has been modified, your changes will be discarded.")); |
2222 | }, |
2223 | /** |
2224 | * Triggers saving the form's record. Chooses between creating a new |
2225 | @@ -993,14 +993,14 @@ |
2226 | buttons: [ |
2227 | {text: _t("Close"), click: function () { d.close(); }}, |
2228 | {text: _t("Save default"), click: function () { |
2229 | - var $defaults = d.$element.find('#formview_default_fields'); |
2230 | + var $defaults = d.$el.find('#formview_default_fields'); |
2231 | var field_to_set = $defaults.val(); |
2232 | if (!field_to_set) { |
2233 | $defaults.parent().addClass('oe_form_invalid'); |
2234 | return; |
2235 | } |
2236 | - var condition = d.$element.find('#formview_default_conditions').val(), |
2237 | - all_users = d.$element.find('#formview_default_all').is(':checked'); |
2238 | + var condition = d.$el.find('#formview_default_conditions').val(), |
2239 | + all_users = d.$el.find('#formview_default_all').is(':checked'); |
2240 | new instance.web.DataSet(self, 'ir.values').call( |
2241 | 'set_default', [ |
2242 | self.dataset.model, |
2243 | @@ -1054,7 +1054,7 @@ |
2244 | instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({ |
2245 | set_fields_view: function(fields_view) {}, |
2246 | set_fields_registry: function(fields_registry) {}, |
2247 | - render_to: function($element) {}, |
2248 | + render_to: function($el) {}, |
2249 | }); |
2250 | |
2251 | /** |
2252 | @@ -1459,7 +1459,7 @@ |
2253 | this.form = new instance.web.FormView(this, this.dataset, this.view_id, { |
2254 | pager: false |
2255 | }); |
2256 | - this.form.appendTo(this.$element); |
2257 | + this.form.appendTo(this.$el); |
2258 | this.form.on_created.add_last(this.on_form_dialog_saved); |
2259 | this.form.on_saved.add_last(this.on_form_dialog_saved); |
2260 | return this; |
2261 | @@ -1551,7 +1551,7 @@ |
2262 | /** |
2263 | * Must be applied over an class already possessing the PropertiesMixin. |
2264 | * |
2265 | - * Apply the result of the "invisible" domain to this.$element. |
2266 | + * Apply the result of the "invisible" domain to this.$el. |
2267 | */ |
2268 | instance.web.form.InvisibilityChangerMixin = { |
2269 | init: function(field_manager, invisible_domain) { |
2270 | @@ -1582,16 +1582,16 @@ |
2271 | this._check_visibility(); |
2272 | }, |
2273 | _check_visibility: function() { |
2274 | - this.$element.toggleClass('oe_form_invisible', this.get("effective_invisible")); |
2275 | + this.$el.toggleClass('oe_form_invisible', this.get("effective_invisible")); |
2276 | }, |
2277 | }; |
2278 | |
2279 | instance.web.form.InvisibilityChanger = instance.web.Class.extend(instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, { |
2280 | - init: function(parent, field_manager, invisible_domain, $element) { |
2281 | + init: function(parent, field_manager, invisible_domain, $el) { |
2282 | this.setParent(parent); |
2283 | instance.web.PropertiesMixin.init.call(this); |
2284 | instance.web.form.InvisibilityChangerMixin.init.call(this, field_manager, invisible_domain); |
2285 | - this.$element = $element; |
2286 | + this.$el = $el; |
2287 | this.start(); |
2288 | }, |
2289 | }); |
2290 | @@ -1615,7 +1615,7 @@ |
2291 | }, |
2292 | renderElement: function() { |
2293 | this._super(); |
2294 | - this.$element.addClass(this.node.attrs["class"] || ""); |
2295 | + this.$el.addClass(this.node.attrs["class"] || ""); |
2296 | }, |
2297 | destroy: function() { |
2298 | $.fn.tipsy.clear(); |
2299 | @@ -1649,7 +1649,7 @@ |
2300 | }, |
2301 | do_attach_tooltip: function(widget, trigger, options) { |
2302 | widget = widget || this; |
2303 | - trigger = trigger || this.$element; |
2304 | + trigger = trigger || this.$el; |
2305 | options = _.extend({ |
2306 | delayIn: 500, |
2307 | delayOut: 0, |
2308 | @@ -1736,11 +1736,11 @@ |
2309 | }, |
2310 | start: function() { |
2311 | this._super.apply(this, arguments); |
2312 | - this.$element.click(this.on_click); |
2313 | + this.$el.click(this.on_click); |
2314 | if (this.node.attrs.help || instance.session.debug) { |
2315 | this.do_attach_tooltip(); |
2316 | } |
2317 | - this.setupFocus(this.$element); |
2318 | + this.setupFocus(this.$el); |
2319 | }, |
2320 | on_click: function() { |
2321 | var self = this; |
2322 | @@ -1799,8 +1799,8 @@ |
2323 | }, |
2324 | check_disable: function() { |
2325 | var disabled = (this.force_disabled || !this.view.is_interactible_record()); |
2326 | - this.$element.prop('disabled', disabled); |
2327 | - this.$element.css('color', disabled ? 'grey' : ''); |
2328 | + this.$el.prop('disabled', disabled); |
2329 | + this.$el.css('color', disabled ? 'grey' : ''); |
2330 | } |
2331 | }); |
2332 | |
2333 | @@ -1929,14 +1929,14 @@ |
2334 | var self = this; |
2335 | this._super(); |
2336 | if (this.field.translate) { |
2337 | - this.$element.addClass('oe_form_field_translatable'); |
2338 | - this.$element.find('.oe_field_translate').click(_.bind(function() { |
2339 | + this.$el.addClass('oe_form_field_translatable'); |
2340 | + this.$el.find('.oe_field_translate').click(_.bind(function() { |
2341 | this.field_manager.open_translate_dialog(this); |
2342 | }, this)); |
2343 | } |
2344 | - this.$label = this.view.$element.find('label[for=' + this.id_for_label + ']'); |
2345 | + this.$label = this.view.$el.find('label[for=' + this.id_for_label + ']'); |
2346 | if (instance.session.debug) { |
2347 | - this.do_attach_tooltip(this, this.$label[0] || this.$element); |
2348 | + this.do_attach_tooltip(this, this.$label[0] || this.$el); |
2349 | this.$label.off('dblclick').on('dblclick', function() { |
2350 | console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view); |
2351 | window.w = self; |
2352 | @@ -1955,7 +1955,7 @@ |
2353 | * Private. Do not use. |
2354 | */ |
2355 | _set_required: function() { |
2356 | - this.$element.toggleClass('oe_form_required', this.get("required")); |
2357 | + this.$el.toggleClass('oe_form_required', this.get("required")); |
2358 | }, |
2359 | set_value: function(value_) { |
2360 | this._inhibit_on_change = true; |
2361 | @@ -1980,11 +1980,11 @@ |
2362 | }, |
2363 | _check_css_flags: function() { |
2364 | if (this.field.translate) { |
2365 | - this.$element.find('.oe_field_translate').toggle(!this.field_manager.is_create_mode()); |
2366 | + this.$el.find('.oe_field_translate').toggle(!this.field_manager.is_create_mode()); |
2367 | } |
2368 | if (!this.disable_utility_classes) { |
2369 | if (this.field_manager.get('display_invalid_fields')) { |
2370 | - this.$element.toggleClass('oe_form_invalid', !this.is_valid()); |
2371 | + this.$el.toggleClass('oe_form_invalid', !this.is_valid()); |
2372 | } |
2373 | } |
2374 | }, |
2375 | @@ -2042,7 +2042,7 @@ |
2376 | }, |
2377 | initialize_content: function() { |
2378 | var self = this; |
2379 | - var $input = this.$element.find('input'); |
2380 | + var $input = this.$el.find('input'); |
2381 | $input.change(function() { |
2382 | self.set({'value': instance.web.parse_value($input.val(), self)}); |
2383 | }); |
2384 | @@ -2055,18 +2055,18 @@ |
2385 | render_value: function() { |
2386 | var show_value = instance.web.format_value(this.get('value'), this, ''); |
2387 | if (!this.get("effective_readonly")) { |
2388 | - this.$element.find('input').val(show_value); |
2389 | + this.$el.find('input').val(show_value); |
2390 | } else { |
2391 | if (this.password) { |
2392 | show_value = new Array(show_value.length + 1).join('*'); |
2393 | } |
2394 | - this.$element.text(show_value); |
2395 | + this.$el.text(show_value); |
2396 | } |
2397 | }, |
2398 | is_syntax_valid: function() { |
2399 | if (!this.get("effective_readonly")) { |
2400 | try { |
2401 | - var value_ = instance.web.parse_value(this.$element.find('input').val(), this, ''); |
2402 | + var value_ = instance.web.parse_value(this.$el.find('input').val(), this, ''); |
2403 | return true; |
2404 | } catch(e) { |
2405 | return false; |
2406 | @@ -2090,7 +2090,7 @@ |
2407 | template: 'FieldEmail', |
2408 | initialize_content: function() { |
2409 | this._super(); |
2410 | - var $button = this.$element.find('button'); |
2411 | + var $button = this.$el.find('button'); |
2412 | $button.click(this.on_button_clicked); |
2413 | this.setupFocus($button); |
2414 | }, |
2415 | @@ -2098,7 +2098,7 @@ |
2416 | if (!this.get("effective_readonly")) { |
2417 | this._super(); |
2418 | } else { |
2419 | - this.$element.find('a') |
2420 | + this.$el.find('a') |
2421 | .attr('href', 'mailto:' + this.get('value')) |
2422 | .text(this.get('value') || ''); |
2423 | } |
2424 | @@ -2116,7 +2116,7 @@ |
2425 | template: 'FieldUrl', |
2426 | initialize_content: function() { |
2427 | this._super(); |
2428 | - var $button = this.$element.find('button'); |
2429 | + var $button = this.$el.find('button'); |
2430 | $button.click(this.on_button_clicked); |
2431 | this.setupFocus($button); |
2432 | }, |
2433 | @@ -2129,7 +2129,7 @@ |
2434 | if (!s) { |
2435 | tmp = "http://" + this.get('value'); |
2436 | } |
2437 | - this.$element.find('a').attr('href', tmp).text(this.get('value') ? tmp : ''); |
2438 | + this.$el.find('a').attr('href', tmp).text(this.get('value') ? tmp : ''); |
2439 | } |
2440 | }, |
2441 | on_button_clicked: function() { |
2442 | @@ -2178,8 +2178,8 @@ |
2443 | }, |
2444 | start: function() { |
2445 | var self = this; |
2446 | - this.$input = this.$element.find('input.oe_datepicker_master'); |
2447 | - this.$input_picker = this.$element.find('input.oe_datepicker_container'); |
2448 | + this.$input = this.$el.find('input.oe_datepicker_master'); |
2449 | + this.$input_picker = this.$el.find('input.oe_datepicker_container'); |
2450 | this.$input.change(this.on_change); |
2451 | this.picker({ |
2452 | onClose: this.on_picker_select, |
2453 | @@ -2189,7 +2189,7 @@ |
2454 | showWeek: true, |
2455 | showButtonPanel: true |
2456 | }); |
2457 | - this.$element.find('img.oe_datepicker_trigger').click(function() { |
2458 | + this.$el.find('img.oe_datepicker_trigger').click(function() { |
2459 | if (self.get("effective_readonly") || self.picker('widget').is(':visible')) { |
2460 | self.$input.focus(); |
2461 | return; |
2462 | @@ -2226,7 +2226,7 @@ |
2463 | set_readonly: function(readonly) { |
2464 | this.readonly = readonly; |
2465 | this.$input.prop('readonly', this.readonly); |
2466 | - this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly); |
2467 | + this.$el.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly); |
2468 | }, |
2469 | is_valid_: function() { |
2470 | var value_ = this.$input.val(); |
2471 | @@ -2276,7 +2276,7 @@ |
2472 | this.datewidget.on_change.add_last(_.bind(function() { |
2473 | this.set({'value': this.datewidget.get_value()}); |
2474 | }, this)); |
2475 | - this.datewidget.appendTo(this.$element); |
2476 | + this.datewidget.appendTo(this.$el); |
2477 | this.setupFocus(this.datewidget.$input); |
2478 | } |
2479 | }, |
2480 | @@ -2288,7 +2288,7 @@ |
2481 | if (!this.get("effective_readonly")) { |
2482 | this.datewidget.set_value(this.get('value')); |
2483 | } else { |
2484 | - this.$element.text(instance.web.format_value(this.get('value'), this, '')); |
2485 | + this.$el.text(instance.web.format_value(this.get('value'), this, '')); |
2486 | } |
2487 | }, |
2488 | is_syntax_valid: function() { |
2489 | @@ -2317,7 +2317,7 @@ |
2490 | instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { |
2491 | template: 'FieldText', |
2492 | initialize_content: function() { |
2493 | - this.$textarea = this.$element.find('textarea'); |
2494 | + this.$textarea = this.$el.find('textarea'); |
2495 | if (!this.get("effective_readonly")) { |
2496 | this.$textarea.change(_.bind(function() { |
2497 | this.set({'value': instance.web.parse_value(this.$textarea.val(), this)}); |
2498 | @@ -2325,7 +2325,7 @@ |
2499 | } else { |
2500 | this.$textarea.attr('disabled', 'disabled'); |
2501 | } |
2502 | - this.$element.keyup(function (e) { |
2503 | + this.$el.keyup(function (e) { |
2504 | if (e.which === $.ui.keyCode.ENTER) { |
2505 | e.stopPropagation(); |
2506 | } |
2507 | @@ -2357,7 +2357,7 @@ |
2508 | is_false: function() { |
2509 | return this.get('value') === '' || this._super(); |
2510 | }, |
2511 | - focus: function($element) { |
2512 | + focus: function($el) { |
2513 | this.$textarea.focus(); |
2514 | }, |
2515 | do_resize: function(max_height) { |
2516 | @@ -2402,7 +2402,7 @@ |
2517 | var self = this; |
2518 | if (! this.get("effective_readonly")) { |
2519 | self._updating_editor = false; |
2520 | - this.$textarea = this.$element.find('textarea'); |
2521 | + this.$textarea = this.$el.find('textarea'); |
2522 | var width = ((this.node.attrs || {}).editor_width || 468); |
2523 | var height = ((this.node.attrs || {}).editor_height || 100); |
2524 | this.$textarea.cleditor({ |
2525 | @@ -2435,7 +2435,7 @@ |
2526 | this.$cleditor.updateFrame(); |
2527 | this._updating_editor = false; |
2528 | } else { |
2529 | - this.$element.html(this.get('value')); |
2530 | + this.$el.html(this.get('value')); |
2531 | } |
2532 | }, |
2533 | }); |
2534 | @@ -2445,9 +2445,9 @@ |
2535 | start: function() { |
2536 | var self = this; |
2537 | this._super.apply(this, arguments); |
2538 | - this.$checkbox = $("input", this.$element); |
2539 | + this.$checkbox = $("input", this.$el); |
2540 | this.setupFocus(this.$checkbox); |
2541 | - this.$element.click(_.bind(function() { |
2542 | + this.$el.click(_.bind(function() { |
2543 | this.set({'value': this.$checkbox.is(':checked')}); |
2544 | }, this)); |
2545 | var check_readonly = function() { |
2546 | @@ -2469,7 +2469,7 @@ |
2547 | template: 'FieldProgressBar', |
2548 | start: function() { |
2549 | this._super.apply(this, arguments); |
2550 | - this.$element.progressbar({ |
2551 | + this.$el.progressbar({ |
2552 | value: this.get('value'), |
2553 | disabled: this.get("effective_readonly") |
2554 | }); |
2555 | @@ -2481,7 +2481,7 @@ |
2556 | show_value = 0; |
2557 | } |
2558 | var formatted_value = instance.web.format_value(show_value, { type : 'float' }, '0'); |
2559 | - this.$element.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%'); |
2560 | + this.$el.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%'); |
2561 | } |
2562 | }); |
2563 | |
2564 | @@ -2512,9 +2512,9 @@ |
2565 | // changing the selected value), takes the action as validating the |
2566 | // row |
2567 | var ischanging = false; |
2568 | - var $select = this.$element.find('select') |
2569 | + var $select = this.$el.find('select') |
2570 | .change(_.bind(function() { |
2571 | - this.set({'value': this.values[this.$element.find('select')[0].selectedIndex][0]}); |
2572 | + this.set({'value': this.values[this.$el.find('select')[0].selectedIndex][0]}); |
2573 | }, this)) |
2574 | .change(function () { ischanging = true; }) |
2575 | .click(function () { ischanging = false; }) |
2576 | @@ -2537,23 +2537,23 @@ |
2577 | for (var i = 0, ii = this.values.length; i < ii; i++) { |
2578 | if (this.values[i][0] === this.get('value')) index = i; |
2579 | } |
2580 | - this.$element.find('select')[0].selectedIndex = index; |
2581 | + this.$el.find('select')[0].selectedIndex = index; |
2582 | } else { |
2583 | var self = this; |
2584 | var option = _(this.values) |
2585 | .detect(function (record) { return record[0] === self.get('value'); }); |
2586 | - this.$element.text(option ? option[1] : this.values[0][1]); |
2587 | + this.$el.text(option ? option[1] : this.values[0][1]); |
2588 | } |
2589 | }, |
2590 | is_syntax_valid: function() { |
2591 | if (this.get("effective_readonly")) { |
2592 | return true; |
2593 | } |
2594 | - var value_ = this.values[this.$element.find('select')[0].selectedIndex]; |
2595 | + var value_ = this.values[this.$el.find('select')[0].selectedIndex]; |
2596 | return !! value_; |
2597 | }, |
2598 | focus: function() { |
2599 | - this.$element.find('select:first').focus(); |
2600 | + this.$el.find('select:first').focus(); |
2601 | } |
2602 | }); |
2603 | |
2604 | @@ -2641,7 +2641,7 @@ |
2605 | } |
2606 | // create... |
2607 | values.push({label: _t("<em> Create and Edit...</em>"), action: function() { |
2608 | - self._search_create_popup("form", undefined, {}); |
2609 | + self._search_create_popup("form", undefined, self._create_context(search_val)); |
2610 | }}); |
2611 | |
2612 | return values; |
2613 | @@ -2653,7 +2653,7 @@ |
2614 | _quick_create: function(name) { |
2615 | var self = this; |
2616 | var slow_create = function () { |
2617 | - self._search_create_popup("form", undefined, {"default_name": name}); |
2618 | + self._search_create_popup("form", undefined, self._create_context(name)); |
2619 | }; |
2620 | if (self.options.quick_create === undefined || self.options.quick_create) { |
2621 | new instance.web.DataSet(this, this.field.relation, self.build_context()) |
2622 | @@ -2690,6 +2690,13 @@ |
2623 | * To implement. |
2624 | */ |
2625 | add_id: function(id) {}, |
2626 | + _create_context: function(name) { |
2627 | + var tmp = {}; |
2628 | + var field = (this.options || {}).create_name_field; |
2629 | + if (field) |
2630 | + tmp["default_" + field] = name; |
2631 | + return tmp; |
2632 | + }, |
2633 | }; |
2634 | |
2635 | instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, { |
2636 | @@ -2724,7 +2731,7 @@ |
2637 | }, |
2638 | render_editable: function() { |
2639 | var self = this; |
2640 | - this.$input = this.$element.find("input"); |
2641 | + this.$input = this.$el.find("input"); |
2642 | |
2643 | self.$input.tipsy({ |
2644 | title: function() { |
2645 | @@ -2744,8 +2751,8 @@ |
2646 | self.$input.tipsy("hide"); |
2647 | }); |
2648 | |
2649 | - this.$drop_down = this.$element.find(".oe_m2o_drop_down_button"); |
2650 | - this.$follow_button = $(".oe_m2o_cm_button", this.$element); |
2651 | + this.$drop_down = this.$el.find(".oe_m2o_drop_down_button"); |
2652 | + this.$follow_button = $(".oe_m2o_cm_button", this.$el); |
2653 | |
2654 | this.$follow_button.click(function() { |
2655 | if (!self.get('value')) { |
2656 | @@ -2919,7 +2926,7 @@ |
2657 | if (follow) |
2658 | link += "<br />"; |
2659 | } |
2660 | - var $link = this.$element.find('.oe_form_uri') |
2661 | + var $link = this.$el.find('.oe_form_uri') |
2662 | .unbind('click') |
2663 | .html(link); |
2664 | if (! this.options.no_open) |
2665 | @@ -2934,7 +2941,7 @@ |
2666 | }); |
2667 | return false; |
2668 | }); |
2669 | - $(".oe_form_m2o_follow", this.$element).html(follow); |
2670 | + $(".oe_form_m2o_follow", this.$el).html(follow); |
2671 | } |
2672 | }, |
2673 | set_value: function(value_) { |
2674 | @@ -3035,7 +3042,7 @@ |
2675 | }, |
2676 | start: function() { |
2677 | this._super.apply(this, arguments); |
2678 | - this.$element.addClass('oe_form_field oe_form_field_one2many'); |
2679 | + this.$el.addClass('oe_form_field oe_form_field_one2many'); |
2680 | |
2681 | var self = this; |
2682 | |
2683 | @@ -3145,7 +3152,7 @@ |
2684 | } |
2685 | } else if (view_type === "form") { |
2686 | if (self.get("effective_readonly")) { |
2687 | - $(".oe_form_buttons", controller.$element).children().remove(); |
2688 | + $(".oe_form_buttons", controller.$el).children().remove(); |
2689 | } |
2690 | controller.on_record_loaded.add_last(function() { |
2691 | once.resolve(); |
2692 | @@ -3166,7 +3173,7 @@ |
2693 | }); |
2694 | this.is_setted.then(function() { |
2695 | $.async_when().then(function () { |
2696 | - self.viewmanager.appendTo(self.$element); |
2697 | + self.viewmanager.appendTo(self.$el); |
2698 | }); |
2699 | }); |
2700 | return def; |
2701 | @@ -3387,7 +3394,7 @@ |
2702 | }, |
2703 | start: function () { |
2704 | var ret = this._super(); |
2705 | - this.$element |
2706 | + this.$el |
2707 | .off('mousedown.handleButtons') |
2708 | .on('mousedown.handleButtons', 'table button', this.proxy('_button_down')); |
2709 | return ret; |
2710 | @@ -3401,7 +3408,7 @@ |
2711 | // If the form has not been modified, the view can only be valid |
2712 | // NB: is_dirty will also be set on defaults/onchanges/whatever? |
2713 | // oe_form_dirty seems to only be set on actual user actions |
2714 | - if (!form.$element.is('.oe_form_dirty')) { |
2715 | + if (!form.$el.is('.oe_form_dirty')) { |
2716 | return true; |
2717 | } |
2718 | this.o2m._dirty_flag = true; |
2719 | @@ -3515,7 +3522,7 @@ |
2720 | return; |
2721 | } |
2722 | // FIXME: why isn't there an API for this? |
2723 | - if (this.editor.form.$element.hasClass('oe_form_dirty')) { |
2724 | + if (this.editor.form.$el.hasClass('oe_form_dirty')) { |
2725 | this.save_edition(); |
2726 | return; |
2727 | } |
2728 | @@ -3643,7 +3650,7 @@ |
2729 | if (this.get("effective_readonly")) |
2730 | return; |
2731 | var self = this; |
2732 | - self.$text = $("textarea", this.$element); |
2733 | + self.$text = $("textarea", this.$el); |
2734 | self.$text.textext({ |
2735 | plugins : 'tags arrow autocomplete', |
2736 | autocomplete: { |
2737 | @@ -3701,7 +3708,7 @@ |
2738 | self._drop_shown = true; |
2739 | }); |
2740 | self.tags = self.$text.textext()[0].tags(); |
2741 | - $("textarea", this.$element).focusout(function() { |
2742 | + $("textarea", this.$el).focusout(function() { |
2743 | self.$text.trigger("setInputData", ""); |
2744 | }).keydown(function(e) { |
2745 | if (e.which === $.ui.keyCode.TAB && self._drop_shown) { |
2746 | @@ -3735,10 +3742,10 @@ |
2747 | data = _.map(values, function(el) { return indexed[el]; }); |
2748 | if (! self.get("effective_readonly")) { |
2749 | self.tags.containerElement().children().remove(); |
2750 | - $("textarea", self.$element).css("padding-left", "3px"); |
2751 | + $("textarea", self.$el).css("padding-left", "3px"); |
2752 | self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};})); |
2753 | } else { |
2754 | - self.$element.html(QWeb.render("FieldMany2ManyTag", {elements: data})); |
2755 | + self.$el.html(QWeb.render("FieldMany2ManyTag", {elements: data})); |
2756 | } |
2757 | }; |
2758 | if (! values || values.length > 0) { |
2759 | @@ -3766,7 +3773,7 @@ |
2760 | }, |
2761 | start: function() { |
2762 | this._super.apply(this, arguments); |
2763 | - this.$element.addClass('oe_form_field oe_form_field_many2many'); |
2764 | + this.$el.addClass('oe_form_field oe_form_field_many2many'); |
2765 | |
2766 | var self = this; |
2767 | |
2768 | @@ -3829,7 +3836,7 @@ |
2769 | loaded.resolve(); |
2770 | }); |
2771 | $.async_when().then(function () { |
2772 | - self.list_view.appendTo(self.$element); |
2773 | + self.list_view.appendTo(self.$el); |
2774 | }); |
2775 | return loaded; |
2776 | }, |
2777 | @@ -3957,7 +3964,7 @@ |
2778 | }); |
2779 | this.kanban_view.do_switch_view.add_last(_.bind(this.open_popup, this)); |
2780 | $.async_when().then(function () { |
2781 | - self.kanban_view.appendTo(self.$element); |
2782 | + self.kanban_view.appendTo(self.$el); |
2783 | }); |
2784 | return loaded; |
2785 | }, |
2786 | @@ -4041,7 +4048,7 @@ |
2787 | }, |
2788 | start: function () { |
2789 | var self = this; |
2790 | - self.$text = this.$element.find('input').css("width", "200px"); |
2791 | + self.$text = this.$el.find('input').css("width", "200px"); |
2792 | self.$text.textext({ |
2793 | plugins : 'arrow autocomplete', |
2794 | autocomplete: { |
2795 | @@ -4149,8 +4156,8 @@ |
2796 | }, |
2797 | title: this.options.title || "", |
2798 | buttons: [{text:"tmp"}], |
2799 | - }, this.$element).open(); |
2800 | - this.$buttonpane = dialog.$element.dialog("widget").find(".ui-dialog-buttonpane").html(""); |
2801 | + }, this.$el).open(); |
2802 | + this.$buttonpane = dialog.$el.dialog("widget").find(".ui-dialog-buttonpane").html(""); |
2803 | this.start(); |
2804 | }, |
2805 | on_write_completed: function() {}, |
2806 | @@ -4173,7 +4180,7 @@ |
2807 | if (this.options.alternative_form_view) { |
2808 | this.view_form.set_embedded_view(this.options.alternative_form_view); |
2809 | } |
2810 | - this.view_form.appendTo(this.$element.find(".oe_popup_form")); |
2811 | + this.view_form.appendTo(this.$el.find(".oe_popup_form")); |
2812 | this.view_form.on_loaded.add_last(function() { |
2813 | var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; |
2814 | self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { |
2815 | @@ -4213,7 +4220,7 @@ |
2816 | this.destroy(); |
2817 | }, |
2818 | destroy: function () { |
2819 | - this.$element.dialog('close'); |
2820 | + this.$el.dialog('close'); |
2821 | this._super(); |
2822 | }, |
2823 | }); |
2824 | @@ -4305,7 +4312,7 @@ |
2825 | e.cancel = true; |
2826 | }); |
2827 | self.view_list.popup = self; |
2828 | - self.view_list.appendTo($(".oe_popup_list", self.$element)).pipe(function() { |
2829 | + self.view_list.appendTo($(".oe_popup_list", self.$el)).pipe(function() { |
2830 | self.view_list.do_show(); |
2831 | }).pipe(function() { |
2832 | self.searchview.do_search(); |
2833 | @@ -4323,7 +4330,7 @@ |
2834 | }); |
2835 | }); |
2836 | }); |
2837 | - this.searchview.appendTo($(".oe_popup_list", self.$element)); |
2838 | + this.searchview.appendTo($(".oe_popup_list", self.$el)); |
2839 | }, |
2840 | do_search: function(domains, contexts, groupbys) { |
2841 | var self = this; |
2842 | @@ -4349,7 +4356,7 @@ |
2843 | this.searchview.hide(); |
2844 | } |
2845 | if (this.view_list) { |
2846 | - this.view_list.$element.hide(); |
2847 | + this.view_list.$el.hide(); |
2848 | } |
2849 | this.setup_form_view(); |
2850 | }, |
2851 | @@ -4382,7 +4389,7 @@ |
2852 | var sel = this.selection.get_value(); |
2853 | this.m2o.field.relation = sel; |
2854 | this.m2o.set_value(false); |
2855 | - this.m2o.$element.toggle(sel !== false); |
2856 | + this.m2o.$el.toggle(sel !== false); |
2857 | } |
2858 | }, |
2859 | destroy_content: function() { |
2860 | @@ -4486,9 +4493,9 @@ |
2861 | this._super.apply(this, arguments); |
2862 | }, |
2863 | initialize_content: function() { |
2864 | - this.$element.find('input.oe_form_binary_file').change(this.on_file_change); |
2865 | - this.$element.find('button.oe_form_binary_file_save').click(this.on_save_as); |
2866 | - this.$element.find('.oe_form_binary_file_clear').click(this.on_clear); |
2867 | + this.$el.find('input.oe_form_binary_file').change(this.on_file_change); |
2868 | + this.$el.find('button.oe_form_binary_file_save').click(this.on_save_as); |
2869 | + this.$el.find('.oe_form_binary_file_clear').click(this.on_clear); |
2870 | }, |
2871 | human_filesize : function(size) { |
2872 | var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
2873 | @@ -4505,10 +4512,10 @@ |
2874 | // http://deepliquid.com/projects/Jcrop/demos.php?demo=handler |
2875 | |
2876 | if ($(e.target).val() !== '') { |
2877 | - this.$element.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id); |
2878 | - this.$element.find('form.oe_form_binary_form').submit(); |
2879 | - this.$element.find('.oe_form_binary_progress').show(); |
2880 | - this.$element.find('.oe_form_binary').hide(); |
2881 | + this.$el.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id); |
2882 | + this.$el.find('form.oe_form_binary_form').submit(); |
2883 | + this.$el.find('.oe_form_binary_progress').show(); |
2884 | + this.$el.find('.oe_form_binary').hide(); |
2885 | } |
2886 | }, |
2887 | on_file_uploaded: function(size, name, content_type, file_base64) { |
2888 | @@ -4520,8 +4527,8 @@ |
2889 | this.filename = name; |
2890 | this.on_file_uploaded_and_valid.apply(this, arguments); |
2891 | } |
2892 | - this.$element.find('.oe_form_binary_progress').hide(); |
2893 | - this.$element.find('.oe_form_binary').show(); |
2894 | + this.$el.find('.oe_form_binary_progress').hide(); |
2895 | + this.$el.find('.oe_form_binary').show(); |
2896 | }, |
2897 | on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { |
2898 | }, |
2899 | @@ -4575,7 +4582,7 @@ |
2900 | this._super(); |
2901 | if (this.get("effective_readonly")) { |
2902 | var self = this; |
2903 | - this.$element.find('a').click(function() { |
2904 | + this.$el.find('a').click(function() { |
2905 | if (self.get('value')) { |
2906 | self.on_save_as(); |
2907 | } |
2908 | @@ -4595,12 +4602,12 @@ |
2909 | } else { |
2910 | show_value = (this.get('value') != null && this.get('value') !== false) ? this.get('value') : ''; |
2911 | } |
2912 | - this.$element.find('input').eq(0).val(show_value); |
2913 | + this.$el.find('input').eq(0).val(show_value); |
2914 | } else { |
2915 | - this.$element.find('a').show(!!this.get('value')); |
2916 | + this.$el.find('a').show(!!this.get('value')); |
2917 | if (this.get('value')) { |
2918 | var show_value = _t("Download") + " " + (this.view.datarecord[this.node.attrs.filename] || ''); |
2919 | - this.$element.find('a').text(show_value); |
2920 | + this.$el.find('a').text(show_value); |
2921 | } |
2922 | } |
2923 | }, |
2924 | @@ -4608,7 +4615,7 @@ |
2925 | this.binary_value = true; |
2926 | this.set({'value': file_base64}); |
2927 | var show_value = name + " (" + this.human_filesize(size) + ")"; |
2928 | - this.$element.find('input').eq(0).val(show_value); |
2929 | + this.$el.find('input').eq(0).val(show_value); |
2930 | this.set_filename(name); |
2931 | }, |
2932 | set_filename: function(value_) { |
2933 | @@ -4619,7 +4626,7 @@ |
2934 | }, |
2935 | on_clear: function() { |
2936 | this._super.apply(this, arguments); |
2937 | - this.$element.find('input').eq(0).val(''); |
2938 | + this.$el.find('input').eq(0).val(''); |
2939 | this.set_filename(''); |
2940 | } |
2941 | }); |
2942 | @@ -4646,8 +4653,8 @@ |
2943 | url = "/web/static/src/img/placeholder.png"; |
2944 | } |
2945 | var $img = $(QWeb.render("FieldBinaryImage-img", { widget: this, url: url })); |
2946 | - this.$element.find('> img').remove(); |
2947 | - this.$element.prepend($img); |
2948 | + this.$el.find('> img').remove(); |
2949 | + this.$el.prepend($img); |
2950 | $img.load(function() { |
2951 | if (! self.options.size) |
2952 | return; |
2953 | @@ -4685,11 +4692,11 @@ |
2954 | // backward compatibility |
2955 | this.loaded = new $.Deferred(); |
2956 | if (this.options.clickable) { |
2957 | - this.$element.on('click','li',this.on_click_stage); |
2958 | + this.$el.on('click','li',this.on_click_stage); |
2959 | } |
2960 | // TODO move the following into css :after |
2961 | - if (this.$element.parent().is('header')) { |
2962 | - this.$element.after('<div class="oe_clear"/>'); |
2963 | + if (this.$el.parent().is('header')) { |
2964 | + this.$el.after('<div class="oe_clear"/>'); |
2965 | } |
2966 | }, |
2967 | set_value: function(value_) { |
2968 | @@ -4750,7 +4757,7 @@ |
2969 | render_elements: function () { |
2970 | var self = this; |
2971 | var content = instance.web.qweb.render("FieldStatus.content", {widget: this}); |
2972 | - this.$element.html(content); |
2973 | + this.$el.html(content); |
2974 | var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}"); |
2975 | var color = colors[this.selected_value]; |
2976 | if (color) { |
2977 | |
2978 | === modified file 'addons/web/static/src/js/view_list.js' |
2979 | --- addons/web/static/src/js/view_list.js 2012-08-14 15:29:00 +0000 |
2980 | +++ addons/web/static/src/js/view_list.js 2012-08-27 06:09:20 +0000 |
2981 | @@ -145,7 +145,7 @@ |
2982 | * @returns {$.Deferred} loading promise |
2983 | */ |
2984 | start: function() { |
2985 | - this.$element.addClass('oe_list'); |
2986 | + this.$el.addClass('oe_list'); |
2987 | return this.reload_view(null, null, true); |
2988 | }, |
2989 | /** |
2990 | @@ -248,20 +248,20 @@ |
2991 | |
2992 | this.setup_columns(this.fields_view.fields, grouped); |
2993 | |
2994 | - this.$element.html(QWeb.render(this._template, this)); |
2995 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
2996 | + this.$el.html(QWeb.render(this._template, this)); |
2997 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
2998 | // Head hook |
2999 | // Selecting records |
3000 | - this.$element.find('.oe_list_record_selector').click(function(){ |
3001 | - self.$element.find('.oe_list_record_selector input').prop('checked', |
3002 | - self.$element.find('.oe_list_record_selector').prop('checked') || false); |
3003 | + this.$el.find('.oe_list_record_selector').click(function(){ |
3004 | + self.$el.find('.oe_list_record_selector input').prop('checked', |
3005 | + self.$el.find('.oe_list_record_selector').prop('checked') || false); |
3006 | var selection = self.groups.get_selection(); |
3007 | $(self.groups).trigger( |
3008 | 'selected', [selection.ids, selection.records]); |
3009 | }); |
3010 | |
3011 | // Sorting columns |
3012 | - this.$element.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) { |
3013 | + this.$el.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) { |
3014 | e.stopPropagation(); |
3015 | var $this = $(this); |
3016 | self.dataset.sort($this.data('id')); |
3017 | @@ -281,7 +281,7 @@ |
3018 | if (this.options.$buttons) { |
3019 | this.$buttons.appendTo(this.options.$buttons); |
3020 | } else { |
3021 | - this.$element.find('.oe_list_buttons').replaceWith(this.$buttons); |
3022 | + this.$el.find('.oe_list_buttons').replaceWith(this.$buttons); |
3023 | } |
3024 | this.$buttons.find('.oe_list_add') |
3025 | .click(this.proxy('do_add_record')) |
3026 | @@ -298,7 +298,7 @@ |
3027 | if (this.options.$buttons) { |
3028 | this.$pager.appendTo(this.options.$pager); |
3029 | } else { |
3030 | - this.$element.find('.oe_list_pager').replaceWith(this.$pager); |
3031 | + this.$el.find('.oe_list_pager').replaceWith(this.$pager); |
3032 | } |
3033 | |
3034 | this.$pager |
3035 | @@ -357,7 +357,7 @@ |
3036 | { label: _t('Delete'), callback: this.do_delete_selected } |
3037 | ]); |
3038 | this.sidebar.add_toolbar(this.fields_view.toolbar); |
3039 | - this.sidebar.$element.hide(); |
3040 | + this.sidebar.$el.hide(); |
3041 | } |
3042 | }, |
3043 | /** |
3044 | @@ -450,7 +450,7 @@ |
3045 | }, |
3046 | do_hide: function () { |
3047 | if (this.sidebar) { |
3048 | - this.sidebar.$element.hide(); |
3049 | + this.sidebar.$el.hide(); |
3050 | } |
3051 | if (this.$buttons) { |
3052 | this.$buttons.hide(); |
3053 | @@ -490,10 +490,10 @@ |
3054 | */ |
3055 | reload_content: function () { |
3056 | var self = this; |
3057 | - self.$element.find('.oe_list_record_selector').prop('checked', false); |
3058 | + self.$el.find('.oe_list_record_selector').prop('checked', false); |
3059 | this.records.reset(); |
3060 | var reloaded = $.Deferred(); |
3061 | - this.$element.find('.oe_list_content').append( |
3062 | + this.$el.find('.oe_list_content').append( |
3063 | this.groups.render(function () { |
3064 | if (self.dataset.index == null) { |
3065 | var has_one = false; |
3066 | @@ -595,7 +595,7 @@ |
3067 | if (!ids.length) { |
3068 | this.dataset.index = 0; |
3069 | if (this.sidebar) { |
3070 | - this.sidebar.$element.hide(); |
3071 | + this.sidebar.$el.hide(); |
3072 | } |
3073 | this.compute_aggregates(); |
3074 | return; |
3075 | @@ -603,7 +603,7 @@ |
3076 | |
3077 | this.dataset.index = _(this.dataset.ids).indexOf(ids[0]); |
3078 | if (this.sidebar) { |
3079 | - this.sidebar.$element.show(); |
3080 | + this.sidebar.$el.show(); |
3081 | } |
3082 | |
3083 | this.compute_aggregates(_(records).map(function (record) { |
3084 | @@ -763,7 +763,7 @@ |
3085 | }, |
3086 | display_aggregates: function (aggregation) { |
3087 | var self = this; |
3088 | - var $footer_cells = this.$element.find('.oe_list_footer'); |
3089 | + var $footer_cells = this.$el.find('.oe_list_footer'); |
3090 | _(this.aggregate_columns).each(function (column) { |
3091 | if (!column['function']) { |
3092 | return; |
3093 | @@ -789,7 +789,7 @@ |
3094 | pad_columns: function (count, options) { |
3095 | options = options || {}; |
3096 | // padding for action/pager header |
3097 | - var $first_header = this.$element.find('thead tr:first th'); |
3098 | + var $first_header = this.$el.find('thead tr:first th'); |
3099 | var colspan = $first_header.attr('colspan'); |
3100 | if (colspan) { |
3101 | if (!this.previous_colspan) { |
3102 | @@ -798,7 +798,7 @@ |
3103 | $first_header.attr('colspan', parseInt(colspan, 10) + count); |
3104 | } |
3105 | // Padding for column titles, footer and data rows |
3106 | - var $rows = this.$element |
3107 | + var $rows = this.$el |
3108 | .find('.oe_list_header_columns, tr:not(thead tr)') |
3109 | .not(options['except']); |
3110 | var newcols = new Array(count+1).join('<td class="oe_list_padding"></td>'); |
3111 | @@ -812,23 +812,23 @@ |
3112 | * Removes all padding columns of the table |
3113 | */ |
3114 | unpad_columns: function () { |
3115 | - this.$element.find('.oe_list_padding').remove(); |
3116 | + this.$el.find('.oe_list_padding').remove(); |
3117 | if (this.previous_colspan) { |
3118 | - this.$element |
3119 | + this.$el |
3120 | .find('thead tr:first th') |
3121 | .attr('colspan', this.previous_colspan); |
3122 | this.previous_colspan = null; |
3123 | } |
3124 | }, |
3125 | no_result: function () { |
3126 | - this.$element.find('.oe_view_nocontent').remove(); |
3127 | + this.$el.find('.oe_view_nocontent').remove(); |
3128 | if (this.groups.group_by |
3129 | || !this.options.action |
3130 | || !this.options.action.help) { |
3131 | return; |
3132 | } |
3133 | - this.$element.find('table:first').hide(); |
3134 | - this.$element.prepend( |
3135 | + this.$el.find('table:first').hide(); |
3136 | + this.$el.prepend( |
3137 | $('<div class="oe_view_nocontent">').html(this.options.action.help) |
3138 | ); |
3139 | } |
3140 | @@ -1478,27 +1478,27 @@ |
3141 | }, |
3142 | render: function (post_render) { |
3143 | var self = this; |
3144 | - var $element = $('<tbody>'); |
3145 | - this.elements = [$element[0]]; |
3146 | + var $el = $('<tbody>'); |
3147 | + this.elements = [$el[0]]; |
3148 | |
3149 | this.datagroup.list( |
3150 | _(this.view.visible_columns).chain() |
3151 | .filter(function (column) { return column.tag === 'field' }) |
3152 | .pluck('name').value(), |
3153 | function (groups) { |
3154 | - $element[0].appendChild( |
3155 | + $el[0].appendChild( |
3156 | self.render_groups(groups)); |
3157 | if (post_render) { post_render(); } |
3158 | }, function (dataset) { |
3159 | self.render_dataset(dataset).then(function (list) { |
3160 | self.children[null] = list; |
3161 | self.elements = |
3162 | - [list.$current.replaceAll($element)[0]]; |
3163 | + [list.$current.replaceAll($el)[0]]; |
3164 | self.setup_resequence_rows(list, dataset); |
3165 | if (post_render) { post_render(); } |
3166 | }); |
3167 | }); |
3168 | - return $element; |
3169 | + return $el; |
3170 | }, |
3171 | /** |
3172 | * Returns the ids of all selected records for this group, and the records |
3173 | |
3174 | === modified file 'addons/web/static/src/js/view_list_editable.js' |
3175 | --- addons/web/static/src/js/view_list_editable.js 2012-08-08 19:38:42 +0000 |
3176 | +++ addons/web/static/src/js/view_list_editable.js 2012-08-27 06:09:20 +0000 |
3177 | @@ -45,10 +45,10 @@ |
3178 | } |
3179 | }); |
3180 | this.on('edit:after', this, function () { |
3181 | - self.$element.add(self.$buttons).addClass('oe_editing'); |
3182 | + self.$el.add(self.$buttons).addClass('oe_editing'); |
3183 | }); |
3184 | this.on('save:after cancel:after', this, function () { |
3185 | - self.$element.add(self.$buttons).removeClass('oe_editing'); |
3186 | + self.$el.add(self.$buttons).removeClass('oe_editing'); |
3187 | }); |
3188 | }, |
3189 | destroy: function () { |
3190 | @@ -87,8 +87,8 @@ |
3191 | */ |
3192 | do_add_record: function () { |
3193 | if (this.editable()) { |
3194 | - this.$element.find('table:first').show(); |
3195 | - this.$element.find('.oe_view_nocontent').remove(); |
3196 | + this.$el.find('table:first').show(); |
3197 | + this.$el.find('.oe_view_nocontent').remove(); |
3198 | this.start_edition(); |
3199 | } else { |
3200 | this._super(); |
3201 | @@ -99,7 +99,7 @@ |
3202 | // tree/@editable takes priority on everything else if present. |
3203 | var result = this._super(data, grouped); |
3204 | if (this.editable()) { |
3205 | - this.$element.addClass('oe_list_editable'); |
3206 | + this.$el.addClass('oe_list_editable'); |
3207 | // FIXME: any hook available to ensure this is only done once? |
3208 | this.$buttons |
3209 | .off('click', '.oe_list_save') |
3210 | @@ -109,7 +109,7 @@ |
3211 | e.preventDefault(); |
3212 | self.cancel_edition(); |
3213 | }); |
3214 | - this.$element |
3215 | + this.$el |
3216 | .off('click', 'tbody td:not(.oe_list_field_cell)') |
3217 | .on('click', 'tbody td:not(.oe_list_field_cell)', function () { |
3218 | if (!self.editor.is_editing()) { |
3219 | @@ -120,12 +120,12 @@ |
3220 | // Editor is not restartable due to formview not being |
3221 | // restartable |
3222 | this.editor = this.make_editor(); |
3223 | - var editor_ready = this.editor.prependTo(this.$element) |
3224 | + var editor_ready = this.editor.prependTo(this.$el) |
3225 | .then(this.proxy('setup_events')); |
3226 | |
3227 | return $.when(result, editor_ready); |
3228 | } else { |
3229 | - this.$element.removeClass('oe_list_editable'); |
3230 | + this.$el.removeClass('oe_list_editable'); |
3231 | } |
3232 | |
3233 | return result; |
3234 | @@ -203,7 +203,7 @@ |
3235 | } |
3236 | |
3237 | // FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow |
3238 | - field.$element.attr('data-fieldname', field_name); |
3239 | + field.$el.attr('data-fieldname', field_name); |
3240 | self.fields_for_resize.push({field: field, cell: cell}); |
3241 | }, options).pipe(function () { |
3242 | $recordRow.addClass('oe_edition'); |
3243 | @@ -249,8 +249,8 @@ |
3244 | var position = $cell.position(); |
3245 | |
3246 | // jquery does not understand !important |
3247 | - field.$element.attr('style', 'width: '+$cell.outerWidth()+'px !important') |
3248 | - field.$element.css({ |
3249 | + field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important') |
3250 | + field.$el.css({ |
3251 | top: position.top, |
3252 | left: position.left, |
3253 | minHeight: $cell.outerHeight() |
3254 | @@ -391,7 +391,7 @@ |
3255 | }, |
3256 | setup_events: function () { |
3257 | var self = this; |
3258 | - this.editor.$element.on('keyup keydown', function (e) { |
3259 | + this.editor.$el.on('keyup keydown', function (e) { |
3260 | if (!self.editor.is_editing()) { return; } |
3261 | var key = _($.ui.keyCode).chain() |
3262 | .map(function (v, k) { return {name: k, code: v}; }) |
3263 | @@ -540,7 +540,7 @@ |
3264 | if (--field_index < 0) { return $.when(); } |
3265 | |
3266 | field = fields[fields_order[field_index]]; |
3267 | - } while (!field.$element.is(':visible')); |
3268 | + } while (!field.$el.is(':visible')); |
3269 | |
3270 | // and focus it |
3271 | field.focus(); |
3272 | @@ -563,7 +563,7 @@ |
3273 | if (++field_index >= fields_order.length) { return $.when(); } |
3274 | |
3275 | field = fields[fields_order[field_index]]; |
3276 | - } while (!field.$element.is(':visible')); |
3277 | + } while (!field.$el.is(':visible')); |
3278 | |
3279 | field.focus(); |
3280 | return $.when(); |
3281 | @@ -572,11 +572,11 @@ |
3282 | var form = this.editor.form; |
3283 | var last_field = _(form.fields_order).chain() |
3284 | .map(function (name) { return form.fields[name]; }) |
3285 | - .filter(function (field) { return field.$element.is(':visible'); }) |
3286 | + .filter(function (field) { return field.$el.is(':visible'); }) |
3287 | .last() |
3288 | .value(); |
3289 | // tabbed from last field in form |
3290 | - if (last_field && last_field.$element.has(e.target).length) { |
3291 | + if (last_field && last_field.$el.has(e.target).length) { |
3292 | e.preventDefault(); |
3293 | return this._next(); |
3294 | } |
3295 | @@ -620,7 +620,7 @@ |
3296 | var _super = this._super(); |
3297 | this.form.embedded_view = this._validate_view( |
3298 | this.delegate.edition_view(this)); |
3299 | - var form_ready = this.form.appendTo(this.$element).then( |
3300 | + var form_ready = this.form.appendTo(this.$el).then( |
3301 | self.form.proxy('do_hide')); |
3302 | return $.when(_super, form_ready); |
3303 | }, |
3304 | @@ -678,7 +678,7 @@ |
3305 | // Is actually in the form |
3306 | && (field = form.fields[focus_field]) |
3307 | // And is visible |
3308 | - && field.$element.is(':visible')) { |
3309 | + && field.$el.is(':visible')) { |
3310 | // focus it |
3311 | field.focus(); |
3312 | return; |
3313 | @@ -687,7 +687,7 @@ |
3314 | _(form.fields_order).detect(function (name) { |
3315 | // look for first visible field in fields_order, focus it |
3316 | var field = form.fields[name]; |
3317 | - if (!field.$element.is(':visible')) { |
3318 | + if (!field.$el.is(':visible')) { |
3319 | return false; |
3320 | } |
3321 | // Stop as soon as a field got focused |
3322 | |
3323 | === modified file 'addons/web/static/src/js/view_tree.js' |
3324 | --- addons/web/static/src/js/view_tree.js 2012-07-03 13:35:08 +0000 |
3325 | +++ addons/web/static/src/js/view_tree.js 2012-08-27 06:09:20 +0000 |
3326 | @@ -84,13 +84,13 @@ |
3327 | }); |
3328 | this.fields = fields_view.fields; |
3329 | this.hook_row_click(); |
3330 | - this.$element.html(QWeb.render('TreeView', { |
3331 | + this.$el.html(QWeb.render('TreeView', { |
3332 | 'title': this.fields_view.arch.attrs.string, |
3333 | 'fields_view': this.fields_view.arch.children, |
3334 | 'fields': this.fields, |
3335 | 'toolbar': has_toolbar |
3336 | })); |
3337 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
3338 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
3339 | |
3340 | this.dataset.read_slice(this.fields_list()).then(function(records) { |
3341 | self.store_record(records); |
3342 | @@ -102,7 +102,7 @@ |
3343 | return; |
3344 | } |
3345 | |
3346 | - var $select = self.$element.find('select') |
3347 | + var $select = self.$el.find('select') |
3348 | .change(function () { |
3349 | var $option = $(this).find(':selected'); |
3350 | self.getdata($option.val()); |
3351 | @@ -120,10 +120,10 @@ |
3352 | $select.change(); |
3353 | } |
3354 | }); |
3355 | - this.$element.find("#tree_view_expand").click(function(){ |
3356 | + this.$el.find("#tree_view_expand").click(function(){ |
3357 | self.expand_all(); |
3358 | }); |
3359 | - this.$element.find("#tree_view_collapse").click(function(){ |
3360 | + this.$el.find("#tree_view_collapse").click(function(){ |
3361 | self.collpase_all(); |
3362 | }); |
3363 | // TODO store open nodes in url ?... |
3364 | @@ -143,14 +143,14 @@ |
3365 | }, |
3366 | expand_all: function(){ |
3367 | var self = this; |
3368 | - var tr = this.$element.find(".oe-treeview-table tbody tr[id^='treerow_']"); |
3369 | + var tr = this.$el.find(".oe-treeview-table tbody tr[id^='treerow_']"); |
3370 | _.each(tr,function(rec){ |
3371 | self.showcontent($(rec).attr('data-id'),true); |
3372 | }); |
3373 | }, |
3374 | collpase_all: function(){ |
3375 | var self = this; |
3376 | - var root_tr = this.$element.find(".oe-treeview-table tbody tr[data-level='"+1+"']"); |
3377 | + var root_tr = this.$el.find(".oe-treeview-table tbody tr[data-level='"+1+"']"); |
3378 | _.each(root_tr,function(rec){ |
3379 | if($(rec).hasClass('oe_open')){ |
3380 | self.showcontent($(rec).attr('data-id'),false); |
3381 | @@ -187,12 +187,12 @@ |
3382 | */ |
3383 | hook_row_click: function () { |
3384 | var self = this; |
3385 | - this.$element.delegate('.treeview-td span, .treeview-tr span', 'click', function (e) { |
3386 | + this.$el.delegate('.treeview-td span, .treeview-tr span', 'click', function (e) { |
3387 | e.stopImmediatePropagation(); |
3388 | self.activate($(this).closest('tr').data('id')); |
3389 | }); |
3390 | |
3391 | - this.$element.delegate('.treeview-tr', 'click', function () { |
3392 | + this.$el.delegate('.treeview-tr', 'click', function () { |
3393 | var $this = $(this), |
3394 | record_id = $this.data('id'), |
3395 | bool = $this.parent().hasClass('oe_open'); |
3396 | @@ -220,7 +220,7 @@ |
3397 | render_data: function(groupby){ |
3398 | var self = this; |
3399 | _.each(_.keys(groupby),function(key){ |
3400 | - var $curr_node = self.$element.find('#treerow_' + key); |
3401 | + var $curr_node = self.$el.find('#treerow_' + key); |
3402 | var record = groupby[key]; |
3403 | var children_rows = QWeb.render('TreeView.rows', { |
3404 | 'records': record, |
3405 | @@ -235,7 +235,7 @@ |
3406 | $curr_node.addClass('oe_open'); |
3407 | $curr_node.after(children_rows); |
3408 | } else { |
3409 | - self.$element.find('tbody').html(children_rows); |
3410 | + self.$el.find('tbody').html(children_rows); |
3411 | } |
3412 | }); |
3413 | self.collpase_all(); |
3414 | @@ -272,11 +272,11 @@ |
3415 | |
3416 | // show & hide the contents |
3417 | showcontent: function (record_id, show) { |
3418 | - this.$element.find('#treerow_' + record_id) |
3419 | + this.$el.find('#treerow_' + record_id) |
3420 | .toggleClass('oe_open', show); |
3421 | |
3422 | _(this.records[record_id][this.children_field]).each(function (child_id) { |
3423 | - var $child_row = this.$element.find('#treerow_' + child_id); |
3424 | + var $child_row = this.$el.find('#treerow_' + child_id); |
3425 | if ($child_row.hasClass('oe_open')) { |
3426 | this.showcontent(child_id, false); |
3427 | } |
3428 | |
3429 | === modified file 'addons/web/static/src/js/views.js' |
3430 | --- addons/web/static/src/js/views.js 2012-08-16 23:55:45 +0000 |
3431 | +++ addons/web/static/src/js/views.js 2012-08-27 06:09:20 +0000 |
3432 | @@ -20,7 +20,7 @@ |
3433 | }, |
3434 | start: function() { |
3435 | this._super.apply(this, arguments); |
3436 | - this.$element.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked); |
3437 | + this.$el.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked); |
3438 | }, |
3439 | dialog_stop: function () { |
3440 | if (this.dialog) { |
3441 | @@ -53,10 +53,10 @@ |
3442 | } |
3443 | var item = _.extend({ |
3444 | show: function(index) { |
3445 | - this.widget.$element.show(); |
3446 | + this.widget.$el.show(); |
3447 | }, |
3448 | hide: function() { |
3449 | - this.widget.$element.hide(); |
3450 | + this.widget.$el.hide(); |
3451 | }, |
3452 | destroy: function() { |
3453 | this.widget.destroy(); |
3454 | @@ -277,14 +277,14 @@ |
3455 | } |
3456 | this.dialog.dialog_title = action.name; |
3457 | this.dialog_widget = widget; |
3458 | - this.dialog_widget.appendTo(this.dialog.$element); |
3459 | + this.dialog_widget.appendTo(this.dialog.$el); |
3460 | this.dialog.open(); |
3461 | } else { |
3462 | this.dialog_stop(); |
3463 | this.inner_action = action; |
3464 | this.inner_widget = widget; |
3465 | post_process(); |
3466 | - this.inner_widget.appendTo(this.$element); |
3467 | + this.inner_widget.appendTo(this.$el); |
3468 | } |
3469 | }, |
3470 | ir_actions_act_window: function (action, on_close) { |
3471 | @@ -376,7 +376,7 @@ |
3472 | start: function() { |
3473 | this._super(); |
3474 | var self = this; |
3475 | - this.$element.find('.oe_view_manager_switch a').click(function() { |
3476 | + this.$el.find('.oe_view_manager_switch a').click(function() { |
3477 | self.on_mode_switch($(this).data('view-type')); |
3478 | }).tipsy(); |
3479 | var views_ids = {}; |
3480 | @@ -385,9 +385,9 @@ |
3481 | deferred : $.Deferred(), |
3482 | controller : null, |
3483 | options : _.extend({ |
3484 | - $buttons : self.$element.find('.oe_view_manager_buttons'), |
3485 | - $sidebar : self.flags.sidebar ? self.$element.find('.oe_view_manager_sidebar') : undefined, |
3486 | - $pager : self.$element.find('.oe_view_manager_pager'), |
3487 | + $buttons : self.$el.find('.oe_view_manager_buttons'), |
3488 | + $sidebar : self.flags.sidebar ? self.$el.find('.oe_view_manager_sidebar') : undefined, |
3489 | + $pager : self.$el.find('.oe_view_manager_pager'), |
3490 | action : self.action, |
3491 | action_views_ids : views_ids |
3492 | }, self.flags, self.flags[view.view_type] || {}, view.options || {}) |
3493 | @@ -395,7 +395,7 @@ |
3494 | views_ids[view.view_type] = view.view_id; |
3495 | }); |
3496 | if (this.flags.views_switcher === false) { |
3497 | - this.$element.find('.oe_view_manager_switch').hide(); |
3498 | + this.$el.find('.oe_view_manager_switch').hide(); |
3499 | } |
3500 | // If no default view defined, switch to the first one in sequence |
3501 | var default_view = this.flags.default_view || this.views_src[0].view_type; |
3502 | @@ -432,9 +432,9 @@ |
3503 | this.searchview[(view.controller.searchable === false || this.searchview.hidden) ? 'hide' : 'show'](); |
3504 | } |
3505 | |
3506 | - this.$element |
3507 | + this.$el |
3508 | .find('.oe_view_manager_switch a').parent().removeClass('active'); |
3509 | - this.$element |
3510 | + this.$el |
3511 | .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]') |
3512 | .parent().addClass('active'); |
3513 | |
3514 | @@ -442,7 +442,7 @@ |
3515 | _.each(_.keys(self.views), function(view_name) { |
3516 | var controller = self.views[view_name].controller; |
3517 | if (controller) { |
3518 | - var container = self.$element.find(".oe_view_manager_view_" + view_name + ":first"); |
3519 | + var container = self.$el.find(".oe_view_manager_view_" + view_name + ":first"); |
3520 | if (view_name === view_type) { |
3521 | container.show(); |
3522 | controller.do_show(view_options || {}); |
3523 | @@ -451,10 +451,10 @@ |
3524 | controller.do_hide(); |
3525 | } |
3526 | // put the <footer> in the dialog's buttonpane |
3527 | - if (self.$element.parent('.ui-dialog-content') && self.$element.find('footer')) { |
3528 | - self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide() |
3529 | - self.$element.find('footer').appendTo( |
3530 | - self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane') |
3531 | + if (self.$el.parent('.ui-dialog-content') && self.$el.find('footer')) { |
3532 | + self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide() |
3533 | + self.$el.find('footer').appendTo( |
3534 | + self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane') |
3535 | ); |
3536 | } |
3537 | } |
3538 | @@ -491,7 +491,7 @@ |
3539 | controller.do_switch_view.add_last(_.bind(this.switch_view, this)); |
3540 | |
3541 | controller.do_prev_view.add_last(this.on_prev_view); |
3542 | - var container = this.$element.find(".oe_view_manager_view_" + view_type); |
3543 | + var container = this.$el.find(".oe_view_manager_view_" + view_type); |
3544 | var view_promise = controller.appendTo(container); |
3545 | this.views[view_type].controller = controller; |
3546 | this.views[view_type].deferred.resolve(view_type); |
3547 | @@ -505,7 +505,7 @@ |
3548 | }); |
3549 | }, |
3550 | set_title: function(title) { |
3551 | - this.$element.find('.oe_view_title_text:first').text(title); |
3552 | + this.$el.find('.oe_view_title_text:first').text(title); |
3553 | }, |
3554 | add_breadcrumb: function() { |
3555 | var self = this; |
3556 | @@ -524,7 +524,7 @@ |
3557 | action: this.action, |
3558 | show: function(index) { |
3559 | var view_to_select = views[index]; |
3560 | - self.$element.show(); |
3561 | + self.$el.show(); |
3562 | if (self.active_view !== view_to_select) { |
3563 | self.on_mode_switch(view_to_select); |
3564 | } |
3565 | @@ -600,7 +600,7 @@ |
3566 | this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false); |
3567 | |
3568 | this.searchview.on_search.add(this.do_searchview_search); |
3569 | - return this.searchview.appendTo(this.$element.find(".oe_view_manager_view_search")); |
3570 | + return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search")); |
3571 | }, |
3572 | do_searchview_search: function(domains, contexts, groupbys) { |
3573 | var self = this, |
3574 | @@ -717,8 +717,8 @@ |
3575 | |
3576 | var manager_ready = $.when(searchview_loaded, main_view_loaded); |
3577 | |
3578 | - this.$element.find('.oe_debug_view').change(this.on_debug_changed); |
3579 | - this.$element.addClass("oe_view_manager_" + (this.action.target || 'current')); |
3580 | + this.$el.find('.oe_debug_view').change(this.on_debug_changed); |
3581 | + this.$el.addClass("oe_view_manager_" + (this.action.target || 'current')); |
3582 | return manager_ready; |
3583 | }, |
3584 | on_debug_changed: function (evt) { |
3585 | @@ -730,7 +730,7 @@ |
3586 | switch (val) { |
3587 | case 'fvg': |
3588 | var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open(); |
3589 | - $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$element); |
3590 | + $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$el); |
3591 | break; |
3592 | case 'perm_read': |
3593 | var ids = current_view.get_selected_ids(); |
3594 | @@ -828,7 +828,7 @@ |
3595 | var controller = self.views[self.active_view].controller, |
3596 | fvg = controller.fields_view, |
3597 | view_id = (fvg && fvg.view_id) || '--'; |
3598 | - self.$element.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { |
3599 | + self.$el.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { |
3600 | view: controller, |
3601 | view_manager: self |
3602 | })); |
3603 | @@ -842,7 +842,7 @@ |
3604 | return r; |
3605 | }, |
3606 | set_title: function(title) { |
3607 | - this.$element.find('.oe_breadcrumb_title:first').html(this.getParent().get_title()); |
3608 | + this.$el.find('.oe_breadcrumb_title:first').html(this.getParent().get_title()); |
3609 | }, |
3610 | do_push_state: function(state) { |
3611 | if (this.getParent() && this.getParent().do_push_state) { |
3612 | @@ -901,7 +901,7 @@ |
3613 | var self = this; |
3614 | this._super(this); |
3615 | this.redraw(); |
3616 | - this.$element.on('click','.oe_dropdown_menu li a', function(event) { |
3617 | + this.$el.on('click','.oe_dropdown_menu li a', function(event) { |
3618 | var section = $(this).data('section'); |
3619 | var index = $(this).data('index'); |
3620 | var item = self.items[section][index]; |
3621 | @@ -917,7 +917,7 @@ |
3622 | }, |
3623 | redraw: function() { |
3624 | var self = this; |
3625 | - self.$element.html(QWeb.render('Sidebar', {widget: self})); |
3626 | + self.$el.html(QWeb.render('Sidebar', {widget: self})); |
3627 | |
3628 | // Hides Sidebar sections when item list is empty |
3629 | this.$('.oe_form_dropdown_section').each(function() { |
3630 | @@ -1024,12 +1024,12 @@ |
3631 | self.items['files'] = attachments; |
3632 | self.redraw(); |
3633 | this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed); |
3634 | - this.$element.find('.oe_sidebar_delete_item').click(this.on_attachment_delete); |
3635 | + this.$el.find('.oe_sidebar_delete_item').click(this.on_attachment_delete); |
3636 | }, |
3637 | on_attachment_changed: function(e) { |
3638 | var $e = $(e.target); |
3639 | if ($e.val() !== '') { |
3640 | - this.$element.find('form.oe_form_binary_form').submit(); |
3641 | + this.$el.find('form.oe_form_binary_form').submit(); |
3642 | $e.parent().find('input[type=file]').prop('disabled', true); |
3643 | $e.parent().find('button').prop('disabled', true).find('img, span').toggle(); |
3644 | this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...')); |
3645 | @@ -1078,8 +1078,8 @@ |
3646 | var self = this; |
3647 | this._super(); |
3648 | $.when(this.languages_loaded).then(function() { |
3649 | - self.$element.html(instance.web.qweb.render('TranslateDialog', { widget: self })); |
3650 | - self.$fields_form = self.$element.find('.oe_translation_form'); |
3651 | + self.$el.html(instance.web.qweb.render('TranslateDialog', { widget: self })); |
3652 | + self.$fields_form = self.$el.find('.oe_translation_form'); |
3653 | self.$fields_form.find('.oe_trad_field').change(function() { |
3654 | $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value'))); |
3655 | }); |
3656 | @@ -1125,8 +1125,8 @@ |
3657 | if (self.view.translatable_fields && self.view.translatable_fields.length) { |
3658 | self.do_load_fields_values(function() { |
3659 | if (field) { |
3660 | - var $field_input = self.$element.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child'); |
3661 | - self.$element.scrollTo($field_input); |
3662 | + var $field_input = self.$el.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child'); |
3663 | + self.$el.scrollTo($field_input); |
3664 | $field_input.focus(); |
3665 | } |
3666 | }); |
3667 | @@ -1302,10 +1302,10 @@ |
3668 | this.embedded_view = embedded_view; |
3669 | }, |
3670 | do_show: function () { |
3671 | - this.$element.show(); |
3672 | + this.$el.show(); |
3673 | }, |
3674 | do_hide: function () { |
3675 | - this.$element.hide(); |
3676 | + this.$el.hide(); |
3677 | }, |
3678 | do_push_state: function(state) { |
3679 | if (this.getParent() && this.getParent().do_push_state) { |
3680 | |
3681 | === modified file 'addons/web/static/src/xml/base.xml' |
3682 | --- addons/web/static/src/xml/base.xml 2012-08-21 09:30:00 +0000 |
3683 | +++ addons/web/static/src/xml/base.xml 2012-08-27 06:09:20 +0000 |
3684 | @@ -1083,7 +1083,7 @@ |
3685 | </span> |
3686 | </t> |
3687 | <t t-name="FieldStatus"> |
3688 | - <ul t-att-class="widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps'" t-att-style="widget.node.attrs.style"/> |
3689 | + <ul t-att-class="'oe_form_field_status ' + (widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps')" t-att-style="widget.node.attrs.style"/> |
3690 | </t> |
3691 | <t t-name="FieldStatus.content"> |
3692 | <t t-foreach="widget.selection" t-as="i"> |
3693 | |
3694 | === modified file 'addons/web/static/test/Widget.js' |
3695 | --- addons/web/static/test/Widget.js 2012-08-01 12:59:10 +0000 |
3696 | +++ addons/web/static/test/Widget.js 2012-08-27 06:09:20 +0000 |
3697 | @@ -86,17 +86,17 @@ |
3698 | test('no template, default', function () { |
3699 | var w = new (instance.web.Widget.extend({ })); |
3700 | |
3701 | - var $original = w.$element; |
3702 | + var $original = w.$el; |
3703 | ok($original, "should initially have a root element"); |
3704 | w.renderElement(); |
3705 | - ok(w.$element, "should have generated a root element"); |
3706 | - ok($original !== w.$element, "should have generated a new root element"); |
3707 | - strictEqual(w.$element, w.$element, "should provide $element alias"); |
3708 | - ok(w.$element.is(w.el), "should provide raw DOM alias"); |
3709 | + ok(w.$el, "should have generated a root element"); |
3710 | + ok($original !== w.$el, "should have generated a new root element"); |
3711 | + strictEqual(w.$el, w.$el, "should provide $el alias"); |
3712 | + ok(w.$el.is(w.el), "should provide raw DOM alias"); |
3713 | |
3714 | equal(w.el.nodeName, 'DIV', "should have generated the default element"); |
3715 | equal(w.el.attributes.length, 0, "should not have generated any attribute"); |
3716 | - ok(_.isEmpty(w.$element.html(), "should not have generated any content")); |
3717 | + ok(_.isEmpty(w.$el.html(), "should not have generated any content")); |
3718 | }); |
3719 | test('no template, custom tag', function () { |
3720 | var w = new (instance.web.Widget.extend({ |
3721 | @@ -113,7 +113,7 @@ |
3722 | w.renderElement(); |
3723 | |
3724 | equal(w.el.attributes.length, 1, "should have one attribute"); |
3725 | - equal(w.$element.attr('id'), 'foo', "should have generated the id attribute"); |
3726 | + equal(w.$el.attr('id'), 'foo', "should have generated the id attribute"); |
3727 | equal(w.el.id, 'foo', "should also be available via property"); |
3728 | }); |
3729 | test('no template, @className', function () { |
3730 | @@ -123,7 +123,7 @@ |
3731 | w.renderElement(); |
3732 | |
3733 | equal(w.el.className, 'oe_some_class', "should have the right property"); |
3734 | - equal(w.$element.attr('class'), 'oe_some_class', "should have the right attribute"); |
3735 | + equal(w.$el.attr('class'), 'oe_some_class', "should have the right attribute"); |
3736 | }); |
3737 | test('no template, bunch of attributes', function () { |
3738 | var w = new (instance.web.Widget.extend({ |
3739 | @@ -140,16 +140,16 @@ |
3740 | equal(w.el.attributes.length, 5, "should have all the specified attributes"); |
3741 | |
3742 | equal(w.el.id, 'some_id'); |
3743 | - equal(w.$element.attr('id'), 'some_id'); |
3744 | + equal(w.$el.attr('id'), 'some_id'); |
3745 | |
3746 | equal(w.el.className, 'some_class'); |
3747 | - equal(w.$element.attr('class'), 'some_class'); |
3748 | - |
3749 | - equal(w.$element.attr('data-foo'), 'data attribute'); |
3750 | - equal(w.$element.data('foo'), 'data attribute'); |
3751 | - |
3752 | - equal(w.$element.attr('clark'), 'gable'); |
3753 | - equal(w.$element.attr('spoiler'), 'snape kills dumbledore'); |
3754 | + equal(w.$el.attr('class'), 'some_class'); |
3755 | + |
3756 | + equal(w.$el.attr('data-foo'), 'data attribute'); |
3757 | + equal(w.$el.data('foo'), 'data attribute'); |
3758 | + |
3759 | + equal(w.$el.attr('clark'), 'gable'); |
3760 | + equal(w.$el.attr('spoiler'), 'snape kills dumbledore'); |
3761 | }); |
3762 | |
3763 | test('template', function () { |
3764 | @@ -159,7 +159,7 @@ |
3765 | w.renderElement(); |
3766 | |
3767 | equal(w.el.nodeName, 'OL'); |
3768 | - equal(w.$element.children().length, 5); |
3769 | + equal(w.$el.children().length, 5); |
3770 | equal(w.el.textContent, '01234'); |
3771 | }); |
3772 | |
3773 | @@ -170,7 +170,7 @@ |
3774 | })); |
3775 | w.renderElement(); |
3776 | |
3777 | - ok(w.$('li:eq(3)').is(w.$element.find('li:eq(3)')), |
3778 | + ok(w.$('li:eq(3)').is(w.$el.find('li:eq(3)')), |
3779 | "should do the same thing as calling find on the widget root"); |
3780 | }); |
3781 | |
3782 | @@ -191,7 +191,7 @@ |
3783 | })); |
3784 | w.renderElement(); |
3785 | |
3786 | - w.$element.click(); |
3787 | + w.$el.click(); |
3788 | w.$('li:eq(3)').click(); |
3789 | w.$('input:last').val('foo').change(); |
3790 | |
3791 | @@ -206,7 +206,7 @@ |
3792 | events: { 'click li': function () { clicked = true; } } |
3793 | })); |
3794 | w.renderElement(); |
3795 | - w.$element.on('click', 'li', function () { newclicked = true }); |
3796 | + w.$el.on('click', 'li', function () { newclicked = true }); |
3797 | |
3798 | w.$('li').click(); |
3799 | ok(clicked, "should trigger bound events"); |
3800 | @@ -229,11 +229,11 @@ |
3801 | .always(start) |
3802 | .done(function () { |
3803 | equal($fix.find('p').text(), '42', "DOM fixture should contain initial value"); |
3804 | - equal(w.$element.text(), '42', "should set initial value"); |
3805 | + equal(w.$el.text(), '42', "should set initial value"); |
3806 | w.value = 36; |
3807 | w.renderElement(); |
3808 | equal($fix.find('p').text(), '36', "DOM fixture should use new value"); |
3809 | - equal(w.$element.text(), '36', "should set new value"); |
3810 | + equal(w.$el.text(), '36', "should set new value"); |
3811 | }); |
3812 | }); |
3813 | }); |
3814 | |
3815 | === modified file 'addons/web_calendar/static/src/js/calendar.js' |
3816 | --- addons/web_calendar/static/src/js/calendar.js 2012-08-16 10:03:53 +0000 |
3817 | +++ addons/web_calendar/static/src/js/calendar.js 2012-08-27 06:09:20 +0000 |
3818 | @@ -49,7 +49,7 @@ |
3819 | }, |
3820 | on_loaded: function(data) { |
3821 | this.fields_view = data; |
3822 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
3823 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
3824 | this.calendar_fields = {}; |
3825 | this.ids = this.dataset.ids; |
3826 | this.color_values = []; |
3827 | @@ -104,7 +104,7 @@ |
3828 | |
3829 | if (!this.sidebar && this.options.$sidebar) { |
3830 | this.sidebar = new instance.web_calendar.Sidebar(this); |
3831 | - this.has_been_loaded.pipe(this.sidebar.appendTo(this.$element.find('.oe_calendar_sidebar_container'))); |
3832 | + this.has_been_loaded.pipe(this.sidebar.appendTo(this.$el.find('.oe_calendar_sidebar_container'))); |
3833 | } |
3834 | |
3835 | return this.has_been_loaded.resolve(); |
3836 | @@ -170,10 +170,10 @@ |
3837 | } |
3838 | }; |
3839 | |
3840 | - scheduler.init(this.$element.find('.oe_calendar')[0], null, this.mode || 'month'); |
3841 | + scheduler.init(this.$el.find('.oe_calendar')[0], null, this.mode || 'month'); |
3842 | |
3843 | // Remove hard coded style attributes from dhtmlx scheduler |
3844 | - this.$element.find(".dhx_cal_navline div").removeAttr('style'); |
3845 | + this.$el.find(".dhx_cal_navline div").removeAttr('style'); |
3846 | |
3847 | scheduler.detachAllEvents(); |
3848 | scheduler.attachEvent('onEventAdded', this.do_create_event); |
3849 | @@ -186,7 +186,7 @@ |
3850 | this.refresh_scheduler(); |
3851 | }, |
3852 | on_view_changed: function(mode, date) { |
3853 | - this.$element.find('.oe_calendar').removeClass('oe_cal_day oe_cal_week oe_cal_month').addClass('oe_cal_' + mode); |
3854 | + this.$el.find('.oe_calendar').removeClass('oe_cal_day oe_cal_week oe_cal_month').addClass('oe_cal_' + mode); |
3855 | if (!date.between(this.range_start, this.range_stop)) { |
3856 | this.update_range_dates(date); |
3857 | this.do_ranged_search(); |
3858 | @@ -429,7 +429,7 @@ |
3859 | do_show: function () { |
3860 | var self = this; |
3861 | $.when(this.has_been_loaded).then(function() { |
3862 | - self.$element.show(); |
3863 | + self.$el.show(); |
3864 | self.do_push_state({}); |
3865 | }); |
3866 | }, |
3867 | @@ -452,7 +452,7 @@ |
3868 | this.form = new instance.web.FormView(this, this.dataset, this.view_id, { |
3869 | pager: false |
3870 | }); |
3871 | - var def = this.form.appendTo(this.$element); |
3872 | + var def = this.form.appendTo(this.$el); |
3873 | this.form.on_created.add_last(this.on_form_dialog_saved); |
3874 | this.form.on_saved.add_last(this.on_form_dialog_saved); |
3875 | this.form.on_button_cancel = function() { |
3876 | @@ -482,7 +482,7 @@ |
3877 | start: function() { |
3878 | this._super(); |
3879 | this.mini_calendar = scheduler.renderCalendar({ |
3880 | - container: this.$element.find('.oe_calendar_mini')[0], |
3881 | + container: this.$el.find('.oe_calendar_mini')[0], |
3882 | navigation: true, |
3883 | date: scheduler._date, |
3884 | handler: function(date, calendar) { |
3885 | @@ -490,7 +490,7 @@ |
3886 | } |
3887 | }); |
3888 | this.filter = new instance.web_calendar.SidebarFilter(this, this.getParent()); |
3889 | - this.filter.appendTo(this.$element.find('.oe_calendar_filter')); |
3890 | + this.filter.appendTo(this.$el.find('.oe_calendar_filter')); |
3891 | } |
3892 | }); |
3893 | instance.web_calendar.SidebarFilter = instance.web.Widget.extend({ |
3894 | @@ -503,7 +503,7 @@ |
3895 | }, |
3896 | on_events_loaded: function(filters) { |
3897 | var selected_filters = this.view.selected_filters.slice(0); |
3898 | - this.$element.html(QWeb.render('CalendarView.sidebar.responsible', { filters: filters })); |
3899 | + this.$el.html(QWeb.render('CalendarView.sidebar.responsible', { filters: filters })); |
3900 | this.$('div.oe_calendar_responsible input').each(function() { |
3901 | if (_.indexOf(selected_filters, $(this).val()) > -1) { |
3902 | $(this).click(); |
3903 | |
3904 | === modified file 'addons/web_diagram/static/src/js/diagram.js' |
3905 | --- addons/web_diagram/static/src/js/diagram.js 2012-08-19 12:46:07 +0000 |
3906 | +++ addons/web_diagram/static/src/js/diagram.js 2012-08-27 06:09:20 +0000 |
3907 | @@ -47,15 +47,15 @@ |
3908 | return label.tag == "label"; |
3909 | }); |
3910 | |
3911 | - this.$element.html(QWeb.render("DiagramView", this)); |
3912 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
3913 | + this.$el.html(QWeb.render("DiagramView", this)); |
3914 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
3915 | |
3916 | _.each(self.labels,function(label){ |
3917 | html_label = '<p style="padding: 4px;">' + label.attrs.string + "</p>"; |
3918 | - self.$element.find('.oe_diagram_header').append(html_label); |
3919 | + self.$el.find('.oe_diagram_header').append(html_label); |
3920 | }) |
3921 | |
3922 | - this.$element.find('div.oe_diagram_pager button[data-pager-action]').click(function() { |
3923 | + this.$el.find('div.oe_diagram_pager button[data-pager-action]').click(function() { |
3924 | var action = $(this).data('pager-action'); |
3925 | self.on_pager_action(action); |
3926 | }); |
3927 | @@ -63,7 +63,7 @@ |
3928 | this.do_update_pager(); |
3929 | |
3930 | // New Node,Edge |
3931 | - this.$element.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();}); |
3932 | + this.$el.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();}); |
3933 | |
3934 | if(this.id) { |
3935 | self.get_diagram_info(); |
3936 | @@ -126,7 +126,7 @@ |
3937 | var res_nodes = result['nodes']; |
3938 | var res_edges = result['conn']; |
3939 | this.parent_field = result.parent_field; |
3940 | - this.$element.find('h3.oe_diagram_title').text(result.name); |
3941 | + this.$el.find('h3.oe_diagram_title').text(result.name); |
3942 | |
3943 | var id_to_node = {}; |
3944 | |
3945 | @@ -161,7 +161,7 @@ |
3946 | }; |
3947 | |
3948 | // remove previous diagram |
3949 | - var canvas = self.$element.find('div.oe_diagram_diagram') |
3950 | + var canvas = self.$el.find('div.oe_diagram_diagram') |
3951 | .empty().get(0); |
3952 | |
3953 | var r = new Raphael(canvas, '100%','100%'); |
3954 | @@ -332,7 +332,7 @@ |
3955 | }); |
3956 | // We want to destroy the dummy edge after a creation cancel. This destroys it even if we save the changes. |
3957 | // This is not a problem since the diagram is completely redrawn on saved changes. |
3958 | - pop.$element.bind("dialogbeforeclose",function(){ |
3959 | + pop.$el.bind("dialogbeforeclose",function(){ |
3960 | if(dummy_cuteedge){ |
3961 | dummy_cuteedge.remove(); |
3962 | } |
3963 | @@ -370,7 +370,7 @@ |
3964 | }, |
3965 | |
3966 | do_update_pager: function(hide_index) { |
3967 | - var $pager = this.$element.find('div.oe_diagram_pager'); |
3968 | + var $pager = this.$el.find('div.oe_diagram_pager'); |
3969 | var index = hide_index ? '-' : this.dataset.index + 1; |
3970 | if(!this.dataset.count) { |
3971 | this.dataset.count = this.dataset.ids.length; |
3972 | |
3973 | === modified file 'addons/web_gantt/static/src/js/gantt.js' |
3974 | --- addons/web_gantt/static/src/js/gantt.js 2012-06-27 15:17:33 +0000 |
3975 | +++ addons/web_gantt/static/src/js/gantt.js 2012-08-27 06:09:20 +0000 |
3976 | @@ -19,7 +19,7 @@ |
3977 | on_loaded: function(fields_view_get, fields_get) { |
3978 | var self = this; |
3979 | this.fields_view = fields_view_get; |
3980 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
3981 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
3982 | return this.rpc("/web/searchview/fields_get", {"model": this.dataset.model}).pipe(function(fields_get) { |
3983 | self.fields = fields_get.fields; |
3984 | self.has_been_loaded.resolve(); |
3985 | @@ -69,7 +69,7 @@ |
3986 | }, |
3987 | on_data_loaded_2: function(tasks, group_bys) { |
3988 | var self = this; |
3989 | - $(".oe_gantt", this.$element).html(""); |
3990 | + $(".oe_gantt", this.$el).html(""); |
3991 | |
3992 | //prevent more that 1 group by |
3993 | if (group_bys.length > 0) { |
3994 | @@ -177,7 +177,7 @@ |
3995 | gantt.create(this.chart_id); |
3996 | |
3997 | // bind event to display task when we click the item in the tree |
3998 | - $(".taskNameItem", self.$element).click(function(event) { |
3999 | + $(".taskNameItem", self.$el).click(function(event) { |
4000 | var task_info = task_ids[event.target.id]; |
4001 | if (task_info) { |
4002 | self.on_task_display(task_info.internal_task); |
4003 | @@ -185,10 +185,10 @@ |
4004 | }); |
4005 | |
4006 | // insertion of create button |
4007 | - var td = $($("table td", self.$element)[0]); |
4008 | + var td = $($("table td", self.$el)[0]); |
4009 | var rendered = QWeb.render("GanttView-create-button"); |
4010 | $(rendered).prependTo(td); |
4011 | - $(".oe_gantt_button_create", this.$element).click(this.on_task_create); |
4012 | + $(".oe_gantt_button_create", this.$el).click(this.on_task_create); |
4013 | }, |
4014 | on_task_changed: function(task_obj) { |
4015 | var self = this; |
4016 | |
4017 | === modified file 'addons/web_graph/static/src/js/graph.js' |
4018 | --- addons/web_graph/static/src/js/graph.js 2012-06-27 15:17:33 +0000 |
4019 | +++ addons/web_graph/static/src/js/graph.js 2012-08-27 06:09:20 +0000 |
4020 | @@ -53,20 +53,20 @@ |
4021 | // TODO: move to load_view and document |
4022 | var self = this; |
4023 | this.fields_view = fields_view_get; |
4024 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
4025 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
4026 | |
4027 | this.mode = this.fields_view.arch.attrs.type || 'bar'; |
4028 | this.orientation = this.fields_view.arch.attrs.orientation == 'horizontal'; |
4029 | |
4030 | - var width = this.$element.parent().width(); |
4031 | - this.$element.css("width", width); |
4032 | - this.container = this.$element.find("#editor-render-body").css({ |
4033 | + var width = this.$el.parent().width(); |
4034 | + this.$el.css("width", width); |
4035 | + this.container = this.$el.find("#editor-render-body").css({ |
4036 | width: width, |
4037 | height: Math.min(500, width * 0.8) |
4038 | })[0]; |
4039 | |
4040 | var graph_render = this.proxy('graph_render'); |
4041 | - this.$element.on('click', '.oe_graph_options a', function (evt) { |
4042 | + this.$el.on('click', '.oe_graph_options a', function (evt) { |
4043 | var $el = $(evt.target); |
4044 | |
4045 | self.graph_render({data: filter_values({ |
4046 | @@ -77,18 +77,18 @@ |
4047 | })}); |
4048 | }); |
4049 | |
4050 | - this.$element.find("#graph_show_data").click(function () { |
4051 | + this.$el.find("#graph_show_data").click(function () { |
4052 | self.spreadsheet = ! self.spreadsheet; |
4053 | self.graph_render(); |
4054 | }); |
4055 | - this.$element.find("#graph_switch").click(function () { |
4056 | + this.$el.find("#graph_switch").click(function () { |
4057 | if (self.mode != 'radar') { |
4058 | self.orientation = ! self.orientation; |
4059 | } |
4060 | self.graph_render(); |
4061 | }); |
4062 | |
4063 | - this.$element.find("#graph_download").click(function () { |
4064 | + this.$el.find("#graph_download").click(function () { |
4065 | if (self.legend == "top") { self.legend = "inside"; } |
4066 | self.forcehtml = true; |
4067 | |
4068 | @@ -110,7 +110,7 @@ |
4069 | switch (this.legend) { |
4070 | case 'top': |
4071 | legend.noColumns = 4; |
4072 | - legend.container = this.$element.find("div.graph_header_legend")[0]; |
4073 | + legend.container = this.$el.find("div.graph_header_legend")[0]; |
4074 | break; |
4075 | case 'inside': |
4076 | legend.position = 'nw'; |
4077 | @@ -257,24 +257,24 @@ |
4078 | } |
4079 | |
4080 | // Render the graph |
4081 | - this.$element.find(".graph_header_legend").children().remove(); |
4082 | + this.$el.find(".graph_header_legend").children().remove(); |
4083 | this.graph = this.make_graph(this.mode, this.container, data); |
4084 | |
4085 | // Update styles of menus |
4086 | |
4087 | - this.$element.find("a").removeClass("active"); |
4088 | + this.$el.find("a").removeClass("active"); |
4089 | |
4090 | - var $active = this.$element.find('a[data-mode=' + this.mode + ']'); |
4091 | + var $active = this.$el.find('a[data-mode=' + this.mode + ']'); |
4092 | if ($active.length > 1) { |
4093 | $active = $active.filter('[data-stacked=' + this.stacked + ']'); |
4094 | } |
4095 | $active = $active.add( |
4096 | - this.$element.find('a:not([data-mode])[data-legend=' + this.legend + ']')); |
4097 | + this.$el.find('a:not([data-mode])[data-legend=' + this.legend + ']')); |
4098 | |
4099 | $active.addClass('active'); |
4100 | |
4101 | if (this.spreadsheet) { |
4102 | - this.$element.find("#graph_show_data").addClass("active"); |
4103 | + this.$el.find("#graph_show_data").addClass("active"); |
4104 | } |
4105 | return this.graph; |
4106 | }, |
4107 | |
4108 | === modified file 'addons/web_graph/static/src/xml/web_graph.xml' |
4109 | --- addons/web_graph/static/src/xml/web_graph.xml 2012-06-25 14:48:45 +0000 |
4110 | +++ addons/web_graph/static/src/xml/web_graph.xml 2012-08-27 06:09:20 +0000 |
4111 | @@ -1,5 +1,5 @@ |
4112 | <template> |
4113 | - <div t-name="GraphView" id="element-chart" class="editor-render" style="position:relative; width: 300px;"> |
4114 | + <div t-name="GraphView" id="element-chart" class="oe_semantic_html_override editor-render" style="position:relative; width: 300px;"> |
4115 | <a href="#" class="oe_e dropdown-menu-icon" data-toggle="dropdown" title="Graph Options">&iacute;</a> |
4116 | <div class="graph_header_legend"> |
4117 | </div> |
4118 | |
4119 | === modified file 'addons/web_kanban/static/src/js/kanban.js' |
4120 | --- addons/web_kanban/static/src/js/kanban.js 2012-08-21 16:15:17 +0000 |
4121 | +++ addons/web_kanban/static/src/js/kanban.js 2012-08-27 06:09:20 +0000 |
4122 | @@ -48,17 +48,17 @@ |
4123 | }, |
4124 | on_loaded: function(data) { |
4125 | this.fields_view = data; |
4126 | - this.$element.addClass(this.fields_view.arch.attrs['class']); |
4127 | + this.$el.addClass(this.fields_view.arch.attrs['class']); |
4128 | this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this})); |
4129 | if (this.options.$buttons) { |
4130 | this.$buttons.appendTo(this.options.$buttons); |
4131 | } else { |
4132 | - this.$element.find('.oe_kanban_buttons').replaceWith(this.$buttons); |
4133 | + this.$el.find('.oe_kanban_buttons').replaceWith(this.$buttons); |
4134 | } |
4135 | this.$buttons |
4136 | .on('click', 'button.oe_kanban_button_new', this.do_add_record) |
4137 | .on('click', '.oe_kanban_add_column', this.do_add_group); |
4138 | - this.$groups = this.$element.find('.oe_kanban_groups tr'); |
4139 | + this.$groups = this.$el.find('.oe_kanban_groups tr'); |
4140 | this.fields_keys = _.keys(this.fields_view.fields); |
4141 | this.add_qweb_template(); |
4142 | this.has_been_loaded.resolve(); |
4143 | @@ -188,14 +188,14 @@ |
4144 | }; |
4145 | var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset); |
4146 | self.do_add_groups([new_group]).then(function() { |
4147 | - $(window).scrollTo(self.groups.slice(-1)[0].$element, { axis: 'x' }); |
4148 | + $(window).scrollTo(self.groups.slice(-1)[0].$el, { axis: 'x' }); |
4149 | }); |
4150 | }); |
4151 | }); |
4152 | }, |
4153 | do_search: function(domain, context, group_by) { |
4154 | var self = this; |
4155 | - this.$element.find('.oe_view_nocontent').remove(); |
4156 | + this.$el.find('.oe_view_nocontent').remove(); |
4157 | this.search_domain = domain; |
4158 | this.search_context = context; |
4159 | this.search_group_by = group_by; |
4160 | @@ -204,14 +204,14 @@ |
4161 | self.group_by_field = self.fields_view.fields[self.group_by] || {}; |
4162 | self.grouped_by_m2o = (self.group_by_field.type === 'many2one'); |
4163 | self.$buttons.find('.oe_alternative').toggle(self.grouped_by_m2o); |
4164 | - self.$element.toggleClass('oe_kanban_grouped_by_m2o', self.grouped_by_m2o); |
4165 | + self.$el.toggleClass('oe_kanban_grouped_by_m2o', self.grouped_by_m2o); |
4166 | self.datagroup = new instance.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []); |
4167 | self.datagroup.list(self.fields_keys, self.do_process_groups, self.do_process_dataset); |
4168 | }); |
4169 | }, |
4170 | do_process_groups: function(groups) { |
4171 | var self = this; |
4172 | - this.$element.remove('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); |
4173 | + this.$el.remove('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); |
4174 | this.add_group_mutex.exec(function() { |
4175 | self.do_clear_groups(); |
4176 | self.dataset.ids = []; |
4177 | @@ -234,7 +234,7 @@ |
4178 | }, |
4179 | do_process_dataset: function(dataset) { |
4180 | var self = this; |
4181 | - this.$element.remove('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); |
4182 | + this.$el.remove('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); |
4183 | this.add_group_mutex.exec(function() { |
4184 | var def = $.Deferred(); |
4185 | self.do_clear_groups(); |
4186 | @@ -268,7 +268,7 @@ |
4187 | }); |
4188 | var groups_started = _.map(this.groups, function(group) { |
4189 | if (!group.is_started) { |
4190 | - return group.insertBefore(self.$element.find('.oe_kanban_groups_headers td:last')); |
4191 | + return group.insertBefore(self.$el.find('.oe_kanban_groups_headers td:last')); |
4192 | } |
4193 | }); |
4194 | return $.when.apply(null, groups_started).then(function () { |
4195 | @@ -280,7 +280,7 @@ |
4196 | this.compute_groups_width(); |
4197 | if (this.group_by) { |
4198 | // Kanban cards drag'n'drop |
4199 | - this.$element.find('.oe_kanban_column').sortable({ |
4200 | + this.$el.find('.oe_kanban_column').sortable({ |
4201 | connectWith: '.oe_kanban_column', |
4202 | handle : '.oe_kanban_draghandle', |
4203 | start: function(event, ui) { |
4204 | @@ -333,13 +333,13 @@ |
4205 | }); |
4206 | } |
4207 | } else { |
4208 | - this.$element.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); |
4209 | + this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); |
4210 | } |
4211 | }, |
4212 | on_record_moved : function(record, old_group, old_index, new_group, new_index) { |
4213 | var self = this; |
4214 | $.fn.tipsy.clear(); |
4215 | - $(old_group.$element).add(new_group.$element).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); |
4216 | + $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); |
4217 | if (old_group === new_group) { |
4218 | new_group.records.splice(old_index, 1); |
4219 | new_group.records.splice(new_index, 0, record); |
4220 | @@ -365,18 +365,18 @@ |
4221 | var self = this; |
4222 | _.each(this.groups, function(group) { |
4223 | unfolded += group.state.folded ? 0 : 1; |
4224 | - group.$element.children(':first').css('width', ''); |
4225 | + group.$el.children(':first').css('width', ''); |
4226 | }); |
4227 | _.each(this.groups, function(group) { |
4228 | if (!group.state.folded) { |
4229 | - if (182*unfolded>=self.$element.width()) { |
4230 | - group.$element.children(':first').css('width', "170px"); |
4231 | - } else if (262*unfolded<self.$element.width()) { |
4232 | - group.$element.children(':first').css('width', "250px"); |
4233 | + if (182*unfolded>=self.$el.width()) { |
4234 | + group.$el.children(':first').css('width', "170px"); |
4235 | + } else if (262*unfolded<self.$el.width()) { |
4236 | + group.$el.children(':first').css('width', "250px"); |
4237 | } else { |
4238 | // -12 because of padding 6 between cards |
4239 | // -1 because of the border of the latest dummy column |
4240 | - group.$element.children(':first').css('width', Math.floor((self.$element.width()-1)/unfolded)-12 + 'px'); |
4241 | + group.$el.children(':first').css('width', Math.floor((self.$el.width()-1)/unfolded)-12 + 'px'); |
4242 | } |
4243 | } |
4244 | }); |
4245 | @@ -408,8 +408,8 @@ |
4246 | || !this.options.action.help) { |
4247 | return; |
4248 | } |
4249 | - this.$element.find('.oe_view_nocontent').remove(); |
4250 | - this.$element.prepend( |
4251 | + this.$el.find('.oe_view_nocontent').remove(); |
4252 | + this.$el.prepend( |
4253 | $('<div class="oe_view_nocontent">').html(this.options.action.help) |
4254 | ); |
4255 | } |
4256 | @@ -471,22 +471,22 @@ |
4257 | var self = this, |
4258 | def = this._super(); |
4259 | if (! self.view.group_by) { |
4260 | - self.$element.addClass("oe_kanban_no_group"); |
4261 | + self.$el.addClass("oe_kanban_no_group"); |
4262 | self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, {}, false) |
4263 | .on('added', self, self.proxy('quick_created')); |
4264 | self.quick.replace($(".oe_kanban_no_group_qc_placeholder")); |
4265 | } |
4266 | this.$records = $(QWeb.render('KanbanView.group_records_container', { widget : this})); |
4267 | - this.$records.insertBefore(this.view.$element.find('.oe_kanban_groups_records td:last')); |
4268 | + this.$records.insertBefore(this.view.$el.find('.oe_kanban_groups_records td:last')); |
4269 | |
4270 | - this.$element.on('click', '.oe_kanban_group_dropdown li a', function(ev) { |
4271 | + this.$el.on('click', '.oe_kanban_group_dropdown li a', function(ev) { |
4272 | var fn = 'do_action_' + $(ev.target).data().action; |
4273 | if (typeof(self[fn]) === 'function') { |
4274 | self[fn]($(ev.target)); |
4275 | } |
4276 | }); |
4277 | |
4278 | - this.$element.find('.oe_kanban_add').click(function () { |
4279 | + this.$el.find('.oe_kanban_add').click(function () { |
4280 | if (self.quick) { return; } |
4281 | var ctx = {}; |
4282 | ctx['default_' + self.view.group_by] = self.value; |
4283 | @@ -500,12 +500,12 @@ |
4284 | self.quick.focus(); |
4285 | }); |
4286 | // Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column. |
4287 | - var add_btn = this.$element.find('.oe_kanban_add'); |
4288 | + var add_btn = this.$el.find('.oe_kanban_add'); |
4289 | this.$records.find('.oe_kanban_show_more').click(this.do_show_more); |
4290 | if (this.state.folded) { |
4291 | this.do_toggle_fold(); |
4292 | } |
4293 | - this.$element.data('widget', this); |
4294 | + this.$el.data('widget', this); |
4295 | this.$records.data('widget', this); |
4296 | this.$has_been_started.resolve(); |
4297 | this.compute_cards_auto_height(); |
4298 | @@ -525,7 +525,7 @@ |
4299 | var min_height = 0; |
4300 | var els = []; |
4301 | _.each(this.records, function(r) { |
4302 | - var $e = r.$element.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0); |
4303 | + var $e = r.$el.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0); |
4304 | if ($e.length) { |
4305 | els.push($e[0]); |
4306 | min_height = Math.max(min_height, $e.outerHeight()); |
4307 | @@ -571,8 +571,8 @@ |
4308 | } |
4309 | }, |
4310 | do_toggle_fold: function(compute_width) { |
4311 | - this.$element.add(this.$records).toggleClass('oe_kanban_group_folded'); |
4312 | - this.state.folded = this.$element.is('.oe_kanban_group_folded'); |
4313 | + this.$el.add(this.$records).toggleClass('oe_kanban_group_folded'); |
4314 | + this.state.folded = this.$el.is('.oe_kanban_group_folded'); |
4315 | this.$("ul.oe_kanban_group_dropdown li a[data-action=toggle_fold]").text((this.state.folded) ? _t("Unfold") : _t("Fold")); |
4316 | }, |
4317 | do_action_toggle_fold: function() { |
4318 | @@ -658,7 +658,7 @@ |
4319 | }, |
4320 | start: function() { |
4321 | this._super(); |
4322 | - this.$element.data('widget', this); |
4323 | + this.$el.data('widget', this); |
4324 | this.bind_events(); |
4325 | }, |
4326 | transform_record: function(record) { |
4327 | @@ -696,14 +696,14 @@ |
4328 | bind_events: function() { |
4329 | var self = this; |
4330 | this.setup_color_picker(); |
4331 | - var $show_on_click = self.$element.find('.oe_kanban_box_show_onclick'); |
4332 | + var $show_on_click = self.$el.find('.oe_kanban_box_show_onclick'); |
4333 | $show_on_click.toggle(this.state.folded); |
4334 | - this.$element.find('.oe_kanban_box_show_onclick_trigger').click(function() { |
4335 | + this.$el.find('.oe_kanban_box_show_onclick_trigger').click(function() { |
4336 | $show_on_click.toggle(); |
4337 | self.state.folded = !self.state.folded; |
4338 | }); |
4339 | |
4340 | - this.$element.find('[tooltip]').tipsy({ |
4341 | + this.$el.find('[tooltip]').tipsy({ |
4342 | delayIn: 500, |
4343 | delayOut: 0, |
4344 | fade: true, |
4345 | @@ -721,11 +721,11 @@ |
4346 | }); |
4347 | |
4348 | // If no draghandle is found, make the whole card as draghandle |
4349 | - if (!this.$element.find('.oe_kanban_draghandle').length) { |
4350 | - this.$element.children(':first').addClass('oe_kanban_draghandle'); |
4351 | + if (!this.$el.find('.oe_kanban_draghandle').length) { |
4352 | + this.$el.children(':first').addClass('oe_kanban_draghandle'); |
4353 | } |
4354 | |
4355 | - this.$element.find('.oe_kanban_action').click(function() { |
4356 | + this.$el.find('.oe_kanban_action').click(function() { |
4357 | var $action = $(this), |
4358 | type = $action.data('type') || 'button', |
4359 | method = 'do_action_' + (type === 'action' ? 'object' : type); |
4360 | @@ -738,8 +738,8 @@ |
4361 | } |
4362 | }); |
4363 | |
4364 | - if (this.$element.find('.oe_kanban_global_click').length) { |
4365 | - this.$element.on('click', function(ev) { |
4366 | + if (this.$el.find('.oe_kanban_global_click').length) { |
4367 | + this.$el.on('click', function(ev) { |
4368 | if (!ev.isTrigger && !$(ev.target).data('events')) { |
4369 | var trigger = true; |
4370 | var elem = ev.target; |
4371 | @@ -784,7 +784,7 @@ |
4372 | }, |
4373 | setup_color_picker: function() { |
4374 | var self = this; |
4375 | - var $el = this.$element.find('ul.oe_kanban_colorpicker'); |
4376 | + var $el = this.$el.find('ul.oe_kanban_colorpicker'); |
4377 | if ($el.length) { |
4378 | $el.html(QWeb.render('KanbanColorPicker', { |
4379 | widget: this |
4380 | @@ -829,7 +829,7 @@ |
4381 | if (records.length) { |
4382 | self.set_record(records[0]); |
4383 | self.renderElement(); |
4384 | - self.$element.data('widget', self); |
4385 | + self.$el.data('widget', self); |
4386 | self.bind_events(); |
4387 | self.group.compute_cards_auto_height(); |
4388 | } else { |
4389 | @@ -923,16 +923,16 @@ |
4390 | }, |
4391 | start: function () { |
4392 | var self = this; |
4393 | - self.$input = this.$element.find('input'); |
4394 | + self.$input = this.$el.find('input'); |
4395 | self.$input.keyup(function(event){ |
4396 | if(event.keyCode == 13){ |
4397 | self.quick_add(); |
4398 | } |
4399 | }); |
4400 | - $(".oe_kanban_quick_create_add", this.$element).click(function () { |
4401 | + $(".oe_kanban_quick_create_add", this.$el).click(function () { |
4402 | self.quick_add(); |
4403 | }); |
4404 | - $(".oe_kanban_quick_create_close", this.$element).click(function () { |
4405 | + $(".oe_kanban_quick_create_close", this.$el).click(function () { |
4406 | self.trigger('close'); |
4407 | }); |
4408 | self.$input.keyup(function(e) { |
4409 | @@ -942,7 +942,7 @@ |
4410 | }); |
4411 | }, |
4412 | focus: function() { |
4413 | - this.$element.find('input').focus(); |
4414 | + this.$el.find('input').focus(); |
4415 | }, |
4416 | /** |
4417 | * Handles user event from nested quick creation view |
4418 | |
4419 | === modified file 'addons/web_kanban/static/src/xml/web_kanban.xml' |
4420 | --- addons/web_kanban/static/src/xml/web_kanban.xml 2012-08-16 13:50:23 +0000 |
4421 | +++ addons/web_kanban/static/src/xml/web_kanban.xml 2012-08-27 06:09:20 +0000 |
4422 | @@ -28,7 +28,7 @@ |
4423 | <t t-name="KanbanView.group_header"> |
4424 | <td class="oe_kanban_group_header"> |
4425 | <t t-if="widget.view.group_by"> |
4426 | - <div class="oe_kanban_header"> |
4427 | + <div class="oe_kanban_header oe_semantic_html_override"> |
4428 | <t t-if="widget.view._is_quick_create_enabled()"> |
4429 | <div class="oe_kanban_add oe_e">]</div> |
4430 | </t> |
4431 | |
4432 | === modified file 'addons/web_mobile/static/src/js/chrome_mobile.js' |
4433 | --- addons/web_mobile/static/src/js/chrome_mobile.js 2012-08-14 13:53:24 +0000 |
4434 | +++ addons/web_mobile/static/src/js/chrome_mobile.js 2012-08-27 06:09:20 +0000 |
4435 | @@ -51,7 +51,7 @@ |
4436 | var self = this; |
4437 | this.session.bind_session().then(function() { |
4438 | instance.web.qweb.add_template("xml/web_mobile.xml"); |
4439 | - self.$element.html(self.render()); |
4440 | + self.$el.html(self.render()); |
4441 | self.login.start(); |
4442 | }); |
4443 | } |
4444 | @@ -76,18 +76,18 @@ |
4445 | self.db_list = result.db_list; |
4446 | this.setElement($('#'+self.element_id).html(self.render(self))); |
4447 | if(self.session.db!=""){ |
4448 | - self.$element.find("#database").val(self.session.db); |
4449 | + self.$el.find("#database").val(self.session.db); |
4450 | } |
4451 | - self.$element.find("#login_btn").click(self.on_login); |
4452 | + self.$el.find("#login_btn").click(self.on_login); |
4453 | $.mobile.initializePage(); |
4454 | }); |
4455 | - this.$element |
4456 | + this.$el |
4457 | .removeClass("login_invalid"); |
4458 | }, |
4459 | on_login: function(ev) { |
4460 | ev.preventDefault(); |
4461 | var self = this; |
4462 | - var $e = this.$element; |
4463 | + var $e = this.$el; |
4464 | var db = $e.find("div select[name=database]").val(); |
4465 | var login = $e.find("div input[name=login]").val(); |
4466 | var password = $e.find("div input[name=password]").val(); |
4467 | @@ -117,13 +117,13 @@ |
4468 | }); |
4469 | }, |
4470 | on_login_invalid: function() { |
4471 | - this.$element |
4472 | + this.$el |
4473 | .removeClass("login_valid") |
4474 | .addClass("login_invalid") |
4475 | .show(); |
4476 | }, |
4477 | on_login_valid: function() { |
4478 | - this.$element |
4479 | + this.$el |
4480 | .removeClass("login_invalid") |
4481 | .addClass("login_valid"); |
4482 | //.hide(); |
4483 | @@ -152,7 +152,7 @@ |
4484 | this._super(session, element_id); |
4485 | }, |
4486 | start: function() { |
4487 | - this.$element.html(this.render(this)); |
4488 | + this.$el.html(this.render(this)); |
4489 | } |
4490 | }); |
4491 | |
4492 | @@ -164,7 +164,7 @@ |
4493 | this._super(session, element_id); |
4494 | }, |
4495 | start: function() { |
4496 | - this.$element.html(this.render(this)); |
4497 | + this.$el.html(this.render(this)); |
4498 | } |
4499 | }); |
4500 | |
4501 | @@ -178,12 +178,12 @@ |
4502 | start: function() { |
4503 | var self = this; |
4504 | this.rpc('/web/session/sc_list',{} ,function(res){ |
4505 | - self.$element.html(self.render({'sc': res})); |
4506 | - self.$element.find("[data-role=header]").find('h1').html('Favourite'); |
4507 | - self.$element.find("[data-role=header]").find('#home').click(function(){ |
4508 | + self.$el.html(self.render({'sc': res})); |
4509 | + self.$el.find("[data-role=header]").find('h1').html('Favourite'); |
4510 | + self.$el.find("[data-role=header]").find('#home').click(function(){ |
4511 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4512 | }); |
4513 | - self.$element.find('#content').find("a").click(self.on_clicked); |
4514 | + self.$el.find('#content').find("a").click(self.on_clicked); |
4515 | $.mobile.changePage("#oe_shortcuts", "slide", false, true); |
4516 | }); |
4517 | }, |
4518 | @@ -228,10 +228,10 @@ |
4519 | this.header.start(); |
4520 | this.footer = new instance.web_mobile.Footer(this, "oe_footer"); |
4521 | this.footer.start(); |
4522 | - this.$element.html(this.render(this.data)); |
4523 | - this.$element.find("[data-role=header]").find('h1').html('Applications'); |
4524 | - this.$element.find("[data-role=header]").find('#home').hide(); |
4525 | - this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){ |
4526 | + this.$el.html(this.render(this.data)); |
4527 | + this.$el.find("[data-role=header]").find('h1').html('Applications'); |
4528 | + this.$el.find("[data-role=header]").find('#home').hide(); |
4529 | + this.$el.find("[data-role=footer]").find('#shrotcuts').click(function(){ |
4530 | if(!$('#oe_shortcuts').html().length){ |
4531 | this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts"); |
4532 | this.shortcuts.start(); |
4533 | @@ -239,7 +239,7 @@ |
4534 | $.mobile.changePage($("#oe_shortcuts"), "slide", false, true); |
4535 | } |
4536 | }); |
4537 | - this.$element.find("[data-role=footer]").find('#preference').click(function(){ |
4538 | + this.$el.find("[data-role=footer]").find('#preference').click(function(){ |
4539 | if(!$('#oe_options').html().length){ |
4540 | this.options = new instance.web_mobile.Options(self, "oe_options"); |
4541 | this.options.start(); |
4542 | @@ -247,7 +247,7 @@ |
4543 | $.mobile.changePage("#oe_options", "slide", false, true); |
4544 | } |
4545 | }); |
4546 | - this.$element.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click); |
4547 | + this.$el.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click); |
4548 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4549 | }, |
4550 | on_menu_click: function(ev, id) { |
4551 | @@ -260,7 +260,7 @@ |
4552 | this.children = this.data.data.children[i]; |
4553 | } |
4554 | } |
4555 | - this.$element |
4556 | + this.$el |
4557 | .removeClass("login_valid") |
4558 | .addClass("secondary_menu"); |
4559 | if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ |
4560 | @@ -284,10 +284,10 @@ |
4561 | start: function(ev, id) { |
4562 | var self = this; |
4563 | var v = { menu : this.data }; |
4564 | - this.$element.html(this.render(v)); |
4565 | - this.$element.find("[data-role=header]").find("h1").html(this.data.name); |
4566 | - this.$element.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click); |
4567 | - this.$element.find("[data-role=header]").find('#home').click(function(){ |
4568 | + this.$el.html(this.render(v)); |
4569 | + this.$el.find("[data-role=header]").find("h1").html(this.data.name); |
4570 | + this.$el.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click); |
4571 | + this.$el.find("[data-role=header]").find('#home').click(function(){ |
4572 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4573 | }); |
4574 | $.mobile.changePage("#"+this.element_id, "slide", false, true); |
4575 | @@ -308,7 +308,7 @@ |
4576 | } |
4577 | } |
4578 | if (child_len > 0) { |
4579 | - this.$element |
4580 | + this.$el |
4581 | .addClass("secondary_menu"); |
4582 | if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ |
4583 | $('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe'); |
4584 | @@ -336,12 +336,12 @@ |
4585 | |
4586 | start: function() { |
4587 | var self = this; |
4588 | - this.$element.html(this.render(this)); |
4589 | - this.$element.find("[data-role=header]").find('h1').html('Preference'); |
4590 | - this.$element.find("[data-role=header]").find('#home').click(function(){ |
4591 | + this.$el.html(this.render(this)); |
4592 | + this.$el.find("[data-role=header]").find('h1').html('Preference'); |
4593 | + this.$el.find("[data-role=header]").find('#home').click(function(){ |
4594 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4595 | }); |
4596 | - this.$element.find("[data-role=content]").find('a').click(function(){ |
4597 | + this.$el.find("[data-role=content]").find('a').click(function(){ |
4598 | $('#oe_login').empty(); |
4599 | window.location.replace('/mobile'); |
4600 | }); |
4601 | |
4602 | === modified file 'addons/web_mobile/static/src/js/form_mobile.js' |
4603 | --- addons/web_mobile/static/src/js/form_mobile.js 2012-08-14 13:53:24 +0000 |
4604 | +++ addons/web_mobile/static/src/js/form_mobile.js 2012-08-27 06:09:20 +0000 |
4605 | @@ -48,12 +48,12 @@ |
4606 | } |
4607 | } |
4608 | self.hidden_fields(get_fields,fields); |
4609 | - self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'})); |
4610 | - self.$element.find("[data-role=header]").find('h1').html(self.head_title); |
4611 | - self.$element.find("[data-role=header]").find('#home').click(function(){ |
4612 | + self.$el.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'})); |
4613 | + self.$el.find("[data-role=header]").find('h1').html(self.head_title); |
4614 | + self.$el.find("[data-role=header]").find('#home').click(function(){ |
4615 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4616 | }); |
4617 | - self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){ |
4618 | + self.$el.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){ |
4619 | for (var k = 0; k < notebooks.children.length; k++) { |
4620 | if (notebooks.children[k].attrs.string == $(this).attr('id')) { |
4621 | get_fields_notebook = self.get_fields(notebooks.children[k].children); |
4622 | @@ -62,7 +62,7 @@ |
4623 | } |
4624 | } |
4625 | }); |
4626 | - self.$element.find('#o2m_m2m').click(function(ev) { |
4627 | + self.$el.find('#o2m_m2m').click(function(ev) { |
4628 | ev.preventDefault(); |
4629 | ev.stopPropagation(); |
4630 | var relational = $(this).attr('for'); |
4631 | @@ -113,7 +113,7 @@ |
4632 | }); |
4633 | } |
4634 | }); |
4635 | - self.$element.find('#m2o_btn').click(this.open_m2o_form); |
4636 | + self.$el.find('#m2o_btn').click(this.open_m2o_form); |
4637 | $.mobile.changePage("#"+self.element_id, "slide", false, true); |
4638 | self.formatdata('', '', '', '',self.element_id,'slider'); |
4639 | }, |
4640 | |
4641 | === modified file 'addons/web_mobile/static/src/js/list_mobile.js' |
4642 | --- addons/web_mobile/static/src/js/list_mobile.js 2012-08-14 13:53:24 +0000 |
4643 | +++ addons/web_mobile/static/src/js/list_mobile.js 2012-08-27 06:09:20 +0000 |
4644 | @@ -44,14 +44,14 @@ |
4645 | if(res['html_name_get']){ |
4646 | additional = res['display']; |
4647 | } |
4648 | - self.$element.html(self.render({'records': res, 'data': additional })); |
4649 | - self.$element.find("[data-role=header]").find('h1').html(self.action.name); |
4650 | - self.$element.find("[data-role=header]").find('#home').click(function(){ |
4651 | + self.$el.html(self.render({'records': res, 'data': additional })); |
4652 | + self.$el.find("[data-role=header]").find('h1').html(self.action.name); |
4653 | + self.$el.find("[data-role=header]").find('#home').click(function(){ |
4654 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4655 | }); |
4656 | - self.$element.find("a#list-id").click(self.on_list_click); |
4657 | + self.$el.find("a#list-id").click(self.on_list_click); |
4658 | $.mobile.changePage("#"+self.element_id, "slide", false, true); |
4659 | - self.$element.find("a#list-id").find('span').addClass('desc'); |
4660 | + self.$el.find("a#list-id").find('span').addClass('desc'); |
4661 | }); |
4662 | }); |
4663 | }, |
4664 | |
4665 | === modified file 'addons/web_process/__openerp__.py' |
4666 | --- addons/web_process/__openerp__.py 2012-08-22 13:03:36 +0000 |
4667 | +++ addons/web_process/__openerp__.py 2012-08-27 06:09:20 +0000 |
4668 | @@ -1,4 +1,5 @@ |
4669 | { |
4670 | + |
4671 | 'name': 'Process', |
4672 | 'version': '2.0', |
4673 | 'description': """ |
4674 | @@ -8,7 +9,7 @@ |
4675 | """, |
4676 | 'depends': ['web_diagram'], |
4677 | 'js': [ |
4678 | - 'static/lib/dracula/*.js', |
4679 | + 'static/lib/js/raphael.js', |
4680 | 'static/src/js/process.js' |
4681 | ], |
4682 | 'css': [ |
4683 | |
4684 | === removed directory 'addons/web_process/static/lib/dracula' |
4685 | === removed file 'addons/web_process/static/lib/dracula/dracula_algorithms.js' |
4686 | --- addons/web_process/static/lib/dracula/dracula_algorithms.js 2012-03-05 11:08:13 +0000 |
4687 | +++ addons/web_process/static/lib/dracula/dracula_algorithms.js 1970-01-01 00:00:00 +0000 |
4688 | @@ -1,599 +0,0 @@ |
4689 | -/* |
4690 | - * Various algorithms and data structures, licensed under the MIT-license. |
4691 | - * (c) 2010 by Johann Philipp Strathausen <strathausen@gmail.com> |
4692 | - * http://strathausen.eu |
4693 | - * |
4694 | - */ |
4695 | - |
4696 | - |
4697 | - |
4698 | -/* |
4699 | - Bellman-Ford |
4700 | - |
4701 | - Path-finding algorithm, finds the shortest paths from one node to all nodes. |
4702 | - |
4703 | - |
4704 | - Complexity |
4705 | - |
4706 | - O( |E| · |V| ), where E = edges and V = vertices (nodes) |
4707 | - |
4708 | - |
4709 | - Constraints |
4710 | - |
4711 | - Can run on graphs with negative edge weights as long as they do not have |
4712 | - any negative weight cycles. |
4713 | - |
4714 | - */ |
4715 | -function bellman_ford(g, source) { |
4716 | - |
4717 | - /* STEP 1: initialisation */ |
4718 | - for(var n in g.nodes) |
4719 | - g.nodes[n].distance = Infinity; |
4720 | - /* predecessors are implicitly null */ |
4721 | - source.distance = 0; |
4722 | - |
4723 | - step("Initially, all distances are infinite and all predecessors are null."); |
4724 | - |
4725 | - /* STEP 2: relax each edge (this is at the heart of Bellman-Ford) */ |
4726 | - /* repeat this for the number of nodes minus one */ |
4727 | - for(var i = 1; i < g.nodes.length; i++) |
4728 | - /* for each edge */ |
4729 | - for(var e in g.edges) { |
4730 | - var edge = g.edges[e]; |
4731 | - if(edge.source.distance + edge.weight < edge.target.distance) { |
4732 | - step("Relax edge between " + edge.source.id + " and " + edge.target.id + "."); |
4733 | - edge.target.distance = edge.source.distance + edge.weight; |
4734 | - edge.target.predecessor = edge.source; |
4735 | - } |
4736 | - //Added by Jake Stothard (Needs to be tested) |
4737 | - if(!edge.style.directed) { |
4738 | - if(edge.target.distance + edge.weight < edge.source.distance) { |
4739 | - g.snapShot("Relax edge between "+edge.target.id+" and "+edge.source.id+"."); |
4740 | - edge.source.distance = edge.target.distance + edge.weight; |
4741 | - edge.source.predecessor = edge.target; |
4742 | - } |
4743 | - } |
4744 | - } |
4745 | - step("Ready."); |
4746 | - |
4747 | - /* STEP 3: TODO Check for negative cycles */ |
4748 | - /* For now we assume here that the graph does not contain any negative |
4749 | - weights cycles. (this is left as an excercise to the reader[tm]) */ |
4750 | -} |
4751 | - |
4752 | - |
4753 | - |
4754 | -/* |
4755 | - Path-finding algorithm Dijkstra |
4756 | - |
4757 | - - worst-case running time is O((|E| + |V|) · log |V| ) thus better than |
4758 | - Bellman-Ford for sparse graphs (with less edges), but cannot handle |
4759 | - negative edge weights |
4760 | - */ |
4761 | -function dijkstra(g, source) { |
4762 | - |
4763 | - /* initially, all distances are infinite and all predecessors are null */ |
4764 | - for(var n in g.nodes) |
4765 | - g.nodes[n].distance = Infinity; |
4766 | - /* predecessors are implicitly null */ |
4767 | - |
4768 | - g.snapShot("Initially, all distances are infinite and all predecessors are null."); |
4769 | - |
4770 | - source.distance = 0; |
4771 | - /* set of unoptimized nodes, sorted by their distance (but a Fibonacci heap |
4772 | - would be better) */ |
4773 | - var q = new BinaryMinHeap(g.nodes, "distance"); |
4774 | - |
4775 | - /* pointer to the node in focus */ |
4776 | - var node; |
4777 | - |
4778 | - /* get the node with the smallest distance |
4779 | - as long as we have unoptimized nodes. q.min() can have O(log n). */ |
4780 | - while(q.min() != undefined) { |
4781 | - /* remove the latest */ |
4782 | - node = q.extractMin(); |
4783 | - node.optimized = true; |
4784 | - |
4785 | - /* no nodes accessible from this one, should not happen */ |
4786 | - if(node.distance == Infinity) |
4787 | - throw "Orphaned node!"; |
4788 | - |
4789 | - /* for each neighbour of node */ |
4790 | - for(e in node.edges) { |
4791 | - var other = (node == node.edges[e].target) ? node.edges[e].source : node.edges[e].target; |
4792 | - |
4793 | - if(other.optimized) |
4794 | - continue; |
4795 | - |
4796 | - /* look for an alternative route */ |
4797 | - var alt = node.distance + node.edges[e].weight; |
4798 | - |
4799 | - /* update distance and route if a better one has been found */ |
4800 | - if (alt < other.distance) { |
4801 | - |
4802 | - /* update distance of neighbour */ |
4803 | - other.distance = alt; |
4804 | - |
4805 | - /* update priority queue */ |
4806 | - q.heapify(); |
4807 | - |
4808 | - /* update path */ |
4809 | - other.predecessor = node; |
4810 | - g.snapShot("Enhancing node.") |
4811 | - } |
4812 | - } |
4813 | - } |
4814 | -} |
4815 | - |
4816 | - |
4817 | -/* All-Pairs-Shortest-Paths */ |
4818 | -/* Runs at worst in O(|V|³) and at best in Omega(|V|³) :-) |
4819 | - complexity Sigma(|V|²) */ |
4820 | -/* This implementation is not yet ready for general use, but works with the |
4821 | - Dracula graph library. */ |
4822 | -function floyd_warshall(g, source) { |
4823 | - |
4824 | - /* Step 1: initialising empty path matrix (second dimension is implicit) */ |
4825 | - var path = []; |
4826 | - var next = []; |
4827 | - var n = g.nodes.length; |
4828 | - |
4829 | - /* construct path matrix, initialize with Infinity */ |
4830 | - for(j in g.nodes) { |
4831 | - path[j] = []; |
4832 | - next[j] = []; |
4833 | - for(i in g.nodes) |
4834 | - path[j][i] = j == i ? 0 : Infinity; |
4835 | - } |
4836 | - |
4837 | - /* initialize path with edge weights */ |
4838 | - for(e in g.edges) |
4839 | - path[g.edges[e].source.id][g.edges[e].target.id] = g.edges[e].weight; |
4840 | - |
4841 | - /* Note: Usually, the initialisation is done by getting the edge weights |
4842 | - from a node matrix representation of the graph, not by iterating through |
4843 | - a list of edges as done here. */ |
4844 | - |
4845 | - /* Step 2: find best distances (the heart of Floyd-Warshall) */ |
4846 | - for(k in g.nodes){ |
4847 | - for(i in g.nodes) { |
4848 | - for(j in g.nodes) |
4849 | - if(path[i][j] > path[i][k] + path[k][j]) { |
4850 | - path[i][j] = path[i][k] + path[k][j]; |
4851 | - /* Step 2.b: remember the path */ |
4852 | - next[i][j] = k; |
4853 | - } |
4854 | - } |
4855 | - } |
4856 | - |
4857 | - /* Step 3: Path reconstruction, get shortest path */ |
4858 | - function getPath(i, j) { |
4859 | - if(path[i][j] == Infinity) |
4860 | - throw "There is no path."; |
4861 | - var intermediate = next[i][j]; |
4862 | - if(intermediate == undefined) |
4863 | - return null; |
4864 | - else |
4865 | - return getPath(i, intermediate) |
4866 | - .concat([intermediate]) |
4867 | - .concat(getPath(intermediate, j)); |
4868 | - } |
4869 | - |
4870 | - /* TODO use the knowledge, e.g. mark path in graph */ |
4871 | -} |
4872 | - |
4873 | -/* |
4874 | - Ford-Fulkerson |
4875 | - |
4876 | - Max-Flow-Min-Cut Algorithm finding the maximum flow through a directed |
4877 | - graph from source to sink. |
4878 | - |
4879 | - |
4880 | - Complexity |
4881 | - |
4882 | - O(E * max(f)), max(f) being the maximum flow |
4883 | - |
4884 | - |
4885 | - Description |
4886 | - |
4887 | - As long as there is an open path through the residual graph, send the |
4888 | - minimum of the residual capacities on the path. |
4889 | - |
4890 | - |
4891 | - Constraints |
4892 | - |
4893 | - The algorithm works only if all weights are integers. Otherwise it is |
4894 | - possible that the Ford–Fulkerson algorithm will not converge to the maximum |
4895 | - value. |
4896 | - |
4897 | - |
4898 | - Input |
4899 | - |
4900 | - g - Graph object |
4901 | - s - Source ID |
4902 | - t - Target (sink) ID |
4903 | - |
4904 | - |
4905 | - Output |
4906 | - |
4907 | - Maximum flow from Source s to Target t |
4908 | - |
4909 | - */ |
4910 | -/* |
4911 | - Edmonds-Karp |
4912 | - |
4913 | - Max-Flow-Min-Cut Algorithm finding the maximum flow through a directed |
4914 | - graph from source to sink. An implementation of the Ford-Fulkerson |
4915 | - algorithm. |
4916 | - |
4917 | - |
4918 | - Complexity |
4919 | - |
4920 | - O(|V|*|E|²) |
4921 | - |
4922 | - |
4923 | - Input |
4924 | - |
4925 | - g - Graph object (with node and edge lists, capacity is a property of edge) |
4926 | - s - source ID |
4927 | - t - sink ID |
4928 | - |
4929 | - */ |
4930 | -function edmonds_karp(g, s, t) { |
4931 | - |
4932 | -} |
4933 | - |
4934 | -/* |
4935 | - A simple binary min-heap serving as a priority queue |
4936 | - - takes an array as the input, with elements having a key property |
4937 | - - elements will look like this: |
4938 | - { |
4939 | - key: "... key property ...", |
4940 | - value: "... element content ..." |
4941 | - } |
4942 | - - provides insert(), min(), extractMin() and heapify() |
4943 | - - example usage (e.g. via the Firebug or Chromium console): |
4944 | - var x = {foo: 20, hui: "bla"}; |
4945 | - var a = new BinaryMinHeap([x,{foo:3},{foo:10},{foo:20},{foo:30},{foo:6},{foo:1},{foo:3}],"foo"); |
4946 | - console.log(a.extractMin()); |
4947 | - console.log(a.extractMin()); |
4948 | - x.foo = 0; // update key |
4949 | - a.heapify(); // call this always after having a key updated |
4950 | - console.log(a.extractMin()); |
4951 | - console.log(a.extractMin()); |
4952 | - - can also be used on a simple array, like [9,7,8,5] |
4953 | - */ |
4954 | -function BinaryMinHeap(array, key) { |
4955 | - |
4956 | - /* Binary tree stored in an array, no need for a complicated data structure */ |
4957 | - var tree = []; |
4958 | - |
4959 | - var key = key || 'key'; |
4960 | - |
4961 | - /* Calculate the index of the parent or a child */ |
4962 | - var parent = function(index) { return Math.floor((index - 1)/2); }; |
4963 | - var right = function(index) { return 2 * index + 2; }; |
4964 | - var left = function(index) { return 2 * index + 1; }; |
4965 | - |
4966 | - /* Helper function to swap elements with their parent |
4967 | - as long as the parent is bigger */ |
4968 | - function bubble_up(i) { |
4969 | - var p = parent(i); |
4970 | - while((p >= 0) && (tree[i][key] < tree[p][key])) { |
4971 | - /* swap with parent */ |
4972 | - tree[i] = tree.splice(p, 1, tree[i])[0]; |
4973 | - /* go up one level */ |
4974 | - i = p; |
4975 | - p = parent(i); |
4976 | - } |
4977 | - } |
4978 | - |
4979 | - /* Helper function to swap elements with the smaller of their children |
4980 | - as long as there is one */ |
4981 | - function bubble_down(i) { |
4982 | - var l = left(i); |
4983 | - var r = right(i); |
4984 | - |
4985 | - /* as long as there are smaller children */ |
4986 | - while(tree[l] && (tree[i][key] > tree[l][key]) || tree[r] && (tree[i][key] > tree[r][key])) { |
4987 | - |
4988 | - /* find smaller child */ |
4989 | - var child = tree[l] ? tree[r] ? tree[l][key] > tree[r][key] ? r : l : l : l; |
4990 | - |
4991 | - /* swap with smaller child with current element */ |
4992 | - tree[i] = tree.splice(child, 1, tree[i])[0]; |
4993 | - |
4994 | - /* go up one level */ |
4995 | - i = child; |
4996 | - l = left(i); |
4997 | - r = right(i); |
4998 | - } |
4999 | - } |
5000 | - |
The diff has been truncated for viewing.