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 | 1 | base.css: base.sass | 1 | base.css: base.sass |
7 | 2 | sass -t expanded base.sass base.css | 2 | sass --trace -t expanded base.sass base.css |
8 | 3 | 3 | ||
9 | 4 | 4 | ||
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 | 141 | background-image: -o-linear-gradient(top, #eeeeee, #dedede); | 141 | background-image: -o-linear-gradient(top, #eeeeee, #dedede); |
15 | 142 | background-image: linear-gradient(to bottom, #eeeeee, #dedede); | 142 | background-image: linear-gradient(to bottom, #eeeeee, #dedede); |
16 | 143 | } | 143 | } |
17 | 144 | .openerp ul, .openerp li, .openerp ol { | ||
18 | 145 | margin: 0; | ||
19 | 146 | padding: 0; | ||
20 | 147 | } | ||
21 | 148 | .openerp li { | ||
22 | 149 | list-style-type: none; | ||
23 | 150 | } | ||
24 | 151 | .openerp input, .openerp textarea, .openerp select { | 144 | .openerp input, .openerp textarea, .openerp select { |
25 | 152 | padding: 2px 4px; | 145 | padding: 2px 4px; |
26 | 153 | border: 1px solid #cccccc; | 146 | border: 1px solid #cccccc; |
27 | @@ -162,6 +155,13 @@ | |||
28 | 162 | .openerp h4 { | 155 | .openerp h4 { |
29 | 163 | margin: 4px 0; | 156 | margin: 4px 0; |
30 | 164 | } | 157 | } |
31 | 158 | .openerp .oe_semantic_html_override ul, .openerp .oe_semantic_html_override li, .openerp .oe_semantic_html_override ol { | ||
32 | 159 | margin: 0; | ||
33 | 160 | padding: 0; | ||
34 | 161 | } | ||
35 | 162 | .openerp .oe_semantic_html_override ul li, .openerp .oe_semantic_html_override li li, .openerp .oe_semantic_html_override ol li { | ||
36 | 163 | list-style-type: none; | ||
37 | 164 | } | ||
38 | 165 | .openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button { | 165 | .openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button { |
39 | 166 | display: inline-block; | 166 | display: inline-block; |
40 | 167 | border: 1px solid #ababab; | 167 | border: 1px solid #ababab; |
41 | @@ -454,13 +454,6 @@ | |||
42 | 454 | -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); | 454 | -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); |
43 | 455 | box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); | 455 | box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); |
44 | 456 | } | 456 | } |
45 | 457 | .openerp ul.oe_flatlist, .openerp ol.oe_flatlist { | ||
46 | 458 | margin: 0; | ||
47 | 459 | padding: 0; | ||
48 | 460 | } | ||
49 | 461 | .openerp ul.oe_flatlist li, .openerp ol.oe_flatlist li { | ||
50 | 462 | list-style-type: none; | ||
51 | 463 | } | ||
52 | 464 | .openerp .oe_form_dirty .oe_highlight_on_dirty { | 457 | .openerp .oe_form_dirty .oe_highlight_on_dirty { |
53 | 465 | color: white; | 458 | color: white; |
54 | 466 | background: #dc5f59; | 459 | background: #dc5f59; |
55 | @@ -633,6 +626,18 @@ | |||
56 | 633 | padding: 0 16px; | 626 | padding: 0 16px; |
57 | 634 | list-style: none; | 627 | list-style: none; |
58 | 635 | zoom: 1; | 628 | zoom: 1; |
59 | 629 | margin: 0; | ||
60 | 630 | padding: 0; | ||
61 | 631 | } | ||
62 | 632 | .openerp .oe_notebook li { | ||
63 | 633 | list-style-type: none; | ||
64 | 634 | } | ||
65 | 635 | .openerp .oe_notebook ul, .openerp .oe_notebook li, .openerp .oe_notebook ol { | ||
66 | 636 | margin: 0; | ||
67 | 637 | padding: 0; | ||
68 | 638 | } | ||
69 | 639 | .openerp .oe_notebook ul li, .openerp .oe_notebook li li, .openerp .oe_notebook ol li { | ||
70 | 640 | list-style-type: none; | ||
71 | 636 | } | 641 | } |
72 | 637 | .openerp .oe_notebook.ui-corner-all { | 642 | .openerp .oe_notebook.ui-corner-all { |
73 | 638 | -moz-border-radius: 0; | 643 | -moz-border-radius: 0; |
74 | @@ -937,6 +942,13 @@ | |||
75 | 937 | -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); | 942 | -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); |
76 | 938 | box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); | 943 | box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); |
77 | 939 | } | 944 | } |
78 | 945 | .openerp .oe_login .oe_login_pane ul, .openerp .oe_login .oe_login_pane li, .openerp .oe_login .oe_login_pane ol { | ||
79 | 946 | margin: 0; | ||
80 | 947 | padding: 0; | ||
81 | 948 | } | ||
82 | 949 | .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 | 950 | list-style-type: none; | ||
84 | 951 | } | ||
85 | 940 | .openerp .oe_login .oe_login_pane h2 { | 952 | .openerp .oe_login .oe_login_pane h2 { |
86 | 941 | margin-top: 0; | 953 | margin-top: 0; |
87 | 942 | font-size: 18px; | 954 | font-size: 18px; |
88 | @@ -1016,6 +1028,13 @@ | |||
89 | 1016 | background-image: -o-linear-gradient(top, #646060, #262626); | 1028 | background-image: -o-linear-gradient(top, #646060, #262626); |
90 | 1017 | background-image: linear-gradient(to bottom, #646060, #262626); | 1029 | background-image: linear-gradient(to bottom, #646060, #262626); |
91 | 1018 | } | 1030 | } |
92 | 1031 | .openerp .oe_topbar ul, .openerp .oe_topbar li, .openerp .oe_topbar ol { | ||
93 | 1032 | margin: 0; | ||
94 | 1033 | padding: 0; | ||
95 | 1034 | } | ||
96 | 1035 | .openerp .oe_topbar ul li, .openerp .oe_topbar li li, .openerp .oe_topbar ol li { | ||
97 | 1036 | list-style-type: none; | ||
98 | 1037 | } | ||
99 | 1019 | .openerp .oe_topbar .oe_topbar_item { | 1038 | .openerp .oe_topbar .oe_topbar_item { |
100 | 1020 | display: block; | 1039 | display: block; |
101 | 1021 | padding: 5px 10px 7px; | 1040 | padding: 5px 10px 7px; |
102 | @@ -1088,6 +1107,13 @@ | |||
103 | 1088 | text-shadow: 0 1px 1px white; | 1107 | text-shadow: 0 1px 1px white; |
104 | 1089 | padding-bottom: 16px; | 1108 | padding-bottom: 16px; |
105 | 1090 | } | 1109 | } |
106 | 1110 | .openerp .oe_leftbar ul, .openerp .oe_leftbar li, .openerp .oe_leftbar ol { | ||
107 | 1111 | margin: 0; | ||
108 | 1112 | padding: 0; | ||
109 | 1113 | } | ||
110 | 1114 | .openerp .oe_leftbar ul li, .openerp .oe_leftbar li li, .openerp .oe_leftbar ol li { | ||
111 | 1115 | list-style-type: none; | ||
112 | 1116 | } | ||
113 | 1091 | .openerp a.oe_logo { | 1117 | .openerp a.oe_logo { |
114 | 1092 | width: 220px; | 1118 | width: 220px; |
115 | 1093 | display: block; | 1119 | display: block; |
116 | @@ -1213,6 +1239,13 @@ | |||
117 | 1213 | margin: 0px; | 1239 | margin: 0px; |
118 | 1214 | padding: 1px 4px; | 1240 | padding: 1px 4px; |
119 | 1215 | } | 1241 | } |
120 | 1242 | .openerp .oe_secondary_submenu .oe_menu_counter:hover { | ||
121 | 1243 | cursor: pointer; | ||
122 | 1244 | border: 1px solid #c81010; | ||
123 | 1245 | -moz-box-shadow: 0 0 2px #c81010; | ||
124 | 1246 | -webkit-box-shadow: 0 0 2px #c81010; | ||
125 | 1247 | box-shadow: 0 0 2px #c81010; | ||
126 | 1248 | } | ||
127 | 1216 | .openerp .oe_secondary_submenu .oe_active { | 1249 | .openerp .oe_secondary_submenu .oe_active { |
128 | 1217 | background: #7c7bad; | 1250 | background: #7c7bad; |
129 | 1218 | border-top: 1px solid lightGray; | 1251 | border-top: 1px solid lightGray; |
130 | @@ -1283,6 +1316,13 @@ | |||
131 | 1283 | width: 100%; | 1316 | width: 100%; |
132 | 1284 | table-layout: fixed; | 1317 | table-layout: fixed; |
133 | 1285 | } | 1318 | } |
134 | 1319 | .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 | 1320 | margin: 0; | ||
136 | 1321 | padding: 0; | ||
137 | 1322 | } | ||
138 | 1323 | .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 | 1324 | list-style-type: none; | ||
140 | 1325 | } | ||
141 | 1286 | .openerp .oe_view_manager table.oe_view_manager_header .oe_header_row { | 1326 | .openerp .oe_view_manager table.oe_view_manager_header .oe_header_row { |
142 | 1287 | clear: both; | 1327 | clear: both; |
143 | 1288 | text-shadow: 0 1px 1px white; | 1328 | text-shadow: 0 1px 1px white; |
144 | @@ -1952,7 +1992,7 @@ | |||
145 | 1952 | .openerp .oe_form div.oe_form_configuration div.oe_horizontal_separator { | 1992 | .openerp .oe_form div.oe_form_configuration div.oe_horizontal_separator { |
146 | 1953 | margin: 12px 0 8px 0; | 1993 | margin: 12px 0 8px 0; |
147 | 1954 | } | 1994 | } |
149 | 1955 | .openerp .oe_form div.oe_form_configuration p { | 1995 | .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 | 1956 | color: #aaaaaa; | 1996 | color: #aaaaaa; |
151 | 1957 | max-width: 650px; | 1997 | max-width: 650px; |
152 | 1958 | } | 1998 | } |
153 | @@ -2401,6 +2441,20 @@ | |||
154 | 2401 | float: right; | 2441 | float: right; |
155 | 2402 | padding-left: 2px; | 2442 | padding-left: 2px; |
156 | 2403 | } | 2443 | } |
157 | 2444 | .openerp .oe_form_field_status { | ||
158 | 2445 | margin: 0; | ||
159 | 2446 | padding: 0; | ||
160 | 2447 | } | ||
161 | 2448 | .openerp .oe_form_field_status ul, .openerp .oe_form_field_status li, .openerp .oe_form_field_status ol { | ||
162 | 2449 | margin: 0; | ||
163 | 2450 | padding: 0; | ||
164 | 2451 | } | ||
165 | 2452 | .openerp .oe_form_field_status ul li, .openerp .oe_form_field_status li li, .openerp .oe_form_field_status ol li { | ||
166 | 2453 | list-style-type: none; | ||
167 | 2454 | } | ||
168 | 2455 | .openerp .oe_form_field_status li { | ||
169 | 2456 | list-style-type: none; | ||
170 | 2457 | } | ||
171 | 2404 | .openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page { | 2458 | .openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page { |
172 | 2405 | display: none; | 2459 | display: none; |
173 | 2406 | } | 2460 | } |
174 | @@ -2763,6 +2817,7 @@ | |||
175 | 2763 | -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); | 2817 | -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); |
176 | 2764 | box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); | 2818 | box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); |
177 | 2765 | margin-top: 4px; | 2819 | margin-top: 4px; |
178 | 2820 | border: 1px solid #afafb6; | ||
179 | 2766 | } | 2821 | } |
180 | 2767 | .ui-menu .ui-menu-item { | 2822 | .ui-menu .ui-menu-item { |
181 | 2768 | width: 100%; | 2823 | width: 100%; |
182 | @@ -2788,7 +2843,3 @@ | |||
183 | 2788 | -webkit-border-radius: 3px; | 2843 | -webkit-border-radius: 3px; |
184 | 2789 | border-radius: 3px; | 2844 | border-radius: 3px; |
185 | 2790 | } | 2845 | } |
186 | 2791 | |||
187 | 2792 | .ui-widget-content { | ||
188 | 2793 | border: 1px solid #afafb6; | ||
189 | 2794 | } | ||
190 | 2795 | 2846 | ||
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 | 111 | content: $icon-name | 111 | content: $icon-name |
196 | 112 | color: $color | 112 | color: $color |
197 | 113 | 113 | ||
198 | 114 | @mixin ul-html-override() | ||
199 | 115 | margin: 0 | ||
200 | 116 | padding: 0 | ||
201 | 117 | li | ||
202 | 118 | list-style-type: none | ||
203 | 119 | |||
204 | 120 | @mixin semantic-html-override() | ||
205 | 121 | ul, li, ol | ||
206 | 122 | @include ul-html-override() | ||
207 | 123 | |||
208 | 114 | // }}} | 124 | // }}} |
209 | 115 | // CSS animation bounces {{{ | 125 | // CSS animation bounces {{{ |
210 | 116 | @-moz-keyframes bounce | 126 | @-moz-keyframes bounce |
211 | @@ -194,11 +204,6 @@ | |||
212 | 194 | @include vertical-gradient(#f0f0fa, #eeeef6) | 204 | @include vertical-gradient(#f0f0fa, #eeeef6) |
213 | 195 | .zebra tbody tr:hover td | 205 | .zebra tbody tr:hover td |
214 | 196 | @include vertical-gradient(#eee, #dedede) | 206 | @include vertical-gradient(#eee, #dedede) |
215 | 197 | ul, li, ol | ||
216 | 198 | margin: 0 | ||
217 | 199 | padding: 0 | ||
218 | 200 | li | ||
219 | 201 | list-style-type: none | ||
220 | 202 | input, textarea, select | 207 | input, textarea, select |
221 | 203 | padding: 2px 4px | 208 | padding: 2px 4px |
222 | 204 | border: 1px solid #ccc | 209 | border: 1px solid #ccc |
223 | @@ -208,6 +213,8 @@ | |||
224 | 208 | vertical-align: middle | 213 | vertical-align: middle |
225 | 209 | h4 | 214 | h4 |
226 | 210 | margin: 4px 0 | 215 | margin: 4px 0 |
227 | 216 | .oe_semantic_html_override | ||
228 | 217 | @include semantic-html-override | ||
229 | 211 | // }}} | 218 | // }}} |
230 | 212 | // Button style {{{ | 219 | // Button style {{{ |
231 | 213 | a.button:link, a.button:visited, button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button | 220 | a.button:link, a.button:visited, button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button |
232 | @@ -391,12 +398,6 @@ | |||
233 | 391 | //@include vertical-gradient(lighten(#dc5f59, 3%), lighten(#b33630, 3%)) | 398 | //@include vertical-gradient(lighten(#dc5f59, 3%), lighten(#b33630, 3%)) |
234 | 392 | @include box-shadow(0 0 1px rgba(0, 0, 0, 0.2)) | 399 | @include box-shadow(0 0 1px rgba(0, 0, 0, 0.2)) |
235 | 393 | 400 | ||
236 | 394 | ul.oe_flatlist, ol.oe_flatlist | ||
237 | 395 | margin: 0 | ||
238 | 396 | padding: 0 | ||
239 | 397 | li | ||
240 | 398 | list-style-type: none | ||
241 | 399 | |||
242 | 400 | .oe_form_dirty | 401 | .oe_form_dirty |
243 | 401 | .oe_highlight_on_dirty | 402 | .oe_highlight_on_dirty |
244 | 402 | color: white | 403 | color: white |
245 | @@ -515,6 +516,8 @@ | |||
246 | 515 | padding: 0 16px | 516 | padding: 0 16px |
247 | 516 | list-style: none | 517 | list-style: none |
248 | 517 | zoom: 1 | 518 | zoom: 1 |
249 | 519 | @include ul-html-override | ||
250 | 520 | @include semantic-html-override | ||
251 | 518 | .oe_notebook.ui-corner-all | 521 | .oe_notebook.ui-corner-all |
252 | 519 | @include radius(0) | 522 | @include radius(0) |
253 | 520 | .oe_notebook:before, .oe_notebook:after | 523 | .oe_notebook:before, .oe_notebook:after |
254 | @@ -734,6 +737,7 @@ | |||
255 | 734 | text-align: left | 737 | text-align: left |
256 | 735 | @include radius(8px) | 738 | @include radius(8px) |
257 | 736 | @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9)) | 739 | @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9)) |
258 | 740 | @include semantic-html-override | ||
259 | 737 | h2 | 741 | h2 |
260 | 738 | margin-top: 0 | 742 | margin-top: 0 |
261 | 739 | font-size: 18px | 743 | font-size: 18px |
262 | @@ -799,6 +803,7 @@ | |||
263 | 799 | height: 31px | 803 | height: 31px |
264 | 800 | border-top: solid 1px #d3d3d3 | 804 | border-top: solid 1px #d3d3d3 |
265 | 801 | @include vertical-gradient(#646060, #262626) | 805 | @include vertical-gradient(#646060, #262626) |
266 | 806 | @include semantic-html-override | ||
267 | 802 | .oe_topbar_item | 807 | .oe_topbar_item |
268 | 803 | display: block | 808 | display: block |
269 | 804 | padding: 5px 10px 7px | 809 | padding: 5px 10px 7px |
270 | @@ -849,6 +854,7 @@ | |||
271 | 849 | border-right: 1px solid $tag-border | 854 | border-right: 1px solid $tag-border |
272 | 850 | text-shadow: 0 1px 1px white | 855 | text-shadow: 0 1px 1px white |
273 | 851 | padding-bottom: 16px | 856 | padding-bottom: 16px |
274 | 857 | @include semantic-html-override | ||
275 | 852 | a.oe_logo | 858 | a.oe_logo |
276 | 853 | width: 220px | 859 | width: 220px |
277 | 854 | display: block | 860 | display: block |
278 | @@ -951,6 +957,10 @@ | |||
279 | 951 | text-shadow: 0 1px 1px rgba(0,0,0,0.2) | 957 | text-shadow: 0 1px 1px rgba(0,0,0,0.2) |
280 | 952 | margin: 0px | 958 | margin: 0px |
281 | 953 | padding: 1px 4px | 959 | padding: 1px 4px |
282 | 960 | &:hover | ||
283 | 961 | cursor: pointer | ||
284 | 962 | border: 1px solid #C81010 | ||
285 | 963 | @include box-shadow(0 0 2px #C81010) | ||
286 | 954 | .oe_active | 964 | .oe_active |
287 | 955 | background: $link-color | 965 | background: $link-color |
288 | 956 | border-top: 1px solid lightGray | 966 | border-top: 1px solid lightGray |
289 | @@ -1009,6 +1019,7 @@ | |||
290 | 1009 | table.oe_view_manager_header | 1019 | table.oe_view_manager_header |
291 | 1010 | width: 100% | 1020 | width: 100% |
292 | 1011 | table-layout: fixed | 1021 | table-layout: fixed |
293 | 1022 | @include semantic-html-override | ||
294 | 1012 | .oe_header_row | 1023 | .oe_header_row |
295 | 1013 | //min-height: 26px | 1024 | //min-height: 26px |
296 | 1014 | //line-height: 26px | 1025 | //line-height: 26px |
297 | @@ -1521,7 +1532,7 @@ | |||
298 | 1521 | div.oe_form_configuration | 1532 | div.oe_form_configuration |
299 | 1522 | div.oe_horizontal_separator | 1533 | div.oe_horizontal_separator |
300 | 1523 | margin: 12px 0 8px 0 | 1534 | margin: 12px 0 8px 0 |
302 | 1524 | p | 1535 | p, ul, ol |
303 | 1525 | color: #aaa | 1536 | color: #aaa |
304 | 1526 | max-width: 650px | 1537 | max-width: 650px |
305 | 1527 | label | 1538 | label |
306 | @@ -1856,6 +1867,11 @@ | |||
307 | 1856 | float: right | 1867 | float: right |
308 | 1857 | padding-left: 2px | 1868 | padding-left: 2px |
309 | 1858 | // }}} | 1869 | // }}} |
310 | 1870 | // FormView.fieldstatus {{{ | ||
311 | 1871 | .oe_form_field_status | ||
312 | 1872 | @include semantic-html-override | ||
313 | 1873 | @include ul-html-override | ||
314 | 1874 | // }}} | ||
315 | 1859 | // FormView.one2many {{{ | 1875 | // FormView.one2many {{{ |
316 | 1860 | .oe_form .oe_form_field_one2many > .oe_view_manager | 1876 | .oe_form .oe_form_field_one2many > .oe_view_manager |
317 | 1861 | .oe_list_pager_single_page | 1877 | .oe_list_pager_single_page |
318 | @@ -2161,6 +2177,7 @@ | |||
319 | 2161 | padding: 2px 0 | 2177 | padding: 2px 0 |
320 | 2162 | @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) | 2178 | @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) |
321 | 2163 | margin-top: 4px | 2179 | margin-top: 4px |
322 | 2180 | border: 1px solid $tag-border | ||
323 | 2164 | .ui-menu-item | 2181 | .ui-menu-item |
324 | 2165 | width: 100% | 2182 | width: 100% |
325 | 2166 | padding: 0 | 2183 | padding: 0 |
326 | @@ -2178,8 +2195,5 @@ | |||
327 | 2178 | .ui-corner-all | 2195 | .ui-corner-all |
328 | 2179 | @include radius(3px) | 2196 | @include radius(3px) |
329 | 2180 | 2197 | ||
330 | 2181 | .ui-widget-content | ||
331 | 2182 | border: 1px solid $tag-border | ||
332 | 2183 | |||
333 | 2184 | // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css" | 2198 | // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css" |
334 | 2185 | // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: | 2199 | // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: |
335 | 2186 | 2200 | ||
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 | 13 | }, | 13 | }, |
341 | 14 | start: function() { | 14 | start: function() { |
342 | 15 | this._super.apply(this, arguments); | 15 | this._super.apply(this, arguments); |
344 | 16 | this.$element.notify({ | 16 | this.$el.notify({ |
345 | 17 | speed: 500, | 17 | speed: 500, |
346 | 18 | expires: 2500 | 18 | expires: 2500 |
347 | 19 | }); | 19 | }); |
348 | @@ -24,7 +24,7 @@ | |||
349 | 24 | if (sticky) { | 24 | if (sticky) { |
350 | 25 | opts.expires = false; | 25 | opts.expires = false; |
351 | 26 | } | 26 | } |
353 | 27 | this.$element.notify('create', { | 27 | this.$el.notify('create', { |
354 | 28 | title: title, | 28 | title: title, |
355 | 29 | text: text | 29 | text: text |
356 | 30 | }, opts); | 30 | }, opts); |
357 | @@ -35,7 +35,7 @@ | |||
358 | 35 | if (sticky) { | 35 | if (sticky) { |
359 | 36 | opts.expires = false; | 36 | opts.expires = false; |
360 | 37 | } | 37 | } |
362 | 38 | this.$element.notify('create', 'oe_notification_alert', { | 38 | this.$el.notify('create', 'oe_notification_alert', { |
363 | 39 | title: title, | 39 | title: title, |
364 | 40 | text: text | 40 | text: text |
365 | 41 | }, opts); | 41 | }, opts); |
366 | @@ -123,22 +123,22 @@ | |||
367 | 123 | if (! this.dialog_inited) | 123 | if (! this.dialog_inited) |
368 | 124 | this.init_dialog(); | 124 | this.init_dialog(); |
369 | 125 | var o = this.get_options(options); | 125 | var o = this.get_options(options); |
371 | 126 | instance.web.dialog(this.$element, o).dialog('open'); | 126 | instance.web.dialog(this.$el, o).dialog('open'); |
372 | 127 | if (o.height === 'auto' && o.max_height) { | 127 | if (o.height === 'auto' && o.max_height) { |
374 | 128 | this.$element.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); | 128 | this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); |
375 | 129 | } | 129 | } |
376 | 130 | return this; | 130 | return this; |
377 | 131 | }, | 131 | }, |
378 | 132 | init_dialog: function(options) { | 132 | init_dialog: function(options) { |
379 | 133 | this.renderElement(); | 133 | this.renderElement(); |
380 | 134 | var o = this.get_options(options); | 134 | var o = this.get_options(options); |
382 | 135 | instance.web.dialog(this.$element, o); | 135 | instance.web.dialog(this.$el, o); |
383 | 136 | var res = this.start(); | 136 | var res = this.start(); |
384 | 137 | this.dialog_inited = true; | 137 | this.dialog_inited = true; |
385 | 138 | return res; | 138 | return res; |
386 | 139 | }, | 139 | }, |
387 | 140 | close: function() { | 140 | close: function() { |
389 | 141 | this.$element.dialog('close'); | 141 | this.$el.dialog('close'); |
390 | 142 | }, | 142 | }, |
391 | 143 | on_close: function() { | 143 | on_close: function() { |
392 | 144 | if (this.__tmp_dialog_destroying) | 144 | if (this.__tmp_dialog_destroying) |
393 | @@ -161,7 +161,7 @@ | |||
394 | 161 | this.__tmp_dialog_destroying = undefined; | 161 | this.__tmp_dialog_destroying = undefined; |
395 | 162 | } | 162 | } |
396 | 163 | if (! this.isDestroyed()) { | 163 | if (! this.isDestroyed()) { |
398 | 164 | this.$element.dialog('destroy'); | 164 | this.$el.dialog('destroy'); |
399 | 165 | } | 165 | } |
400 | 166 | this._super(); | 166 | this._super(); |
401 | 167 | } | 167 | } |
402 | @@ -224,7 +224,7 @@ | |||
403 | 224 | min_height: '600px', | 224 | min_height: '600px', |
404 | 225 | buttons: buttons | 225 | buttons: buttons |
405 | 226 | }).open(); | 226 | }).open(); |
407 | 227 | dialog.$element.html(QWeb.render('CrashManager.error', {session: instance.session, error: error})); | 227 | dialog.$el.html(QWeb.render('CrashManager.error', {session: instance.session, error: error})); |
408 | 228 | }, | 228 | }, |
409 | 229 | on_javascript_exception: function(exception) { | 229 | on_javascript_exception: function(exception) { |
410 | 230 | this.on_traceback({ | 230 | this.on_traceback({ |
411 | @@ -270,12 +270,12 @@ | |||
412 | 270 | this.count += increment; | 270 | this.count += increment; |
413 | 271 | if (this.count > 0) { | 271 | if (this.count > 0) { |
414 | 272 | if (instance.session.debug) { | 272 | if (instance.session.debug) { |
416 | 273 | this.$element.text(_.str.sprintf( _t("Loading (%d)"), this.count)); | 273 | this.$el.text(_.str.sprintf( _t("Loading (%d)"), this.count)); |
417 | 274 | } else { | 274 | } else { |
419 | 275 | this.$element.text(_t("Loading")); | 275 | this.$el.text(_t("Loading")); |
420 | 276 | } | 276 | } |
423 | 277 | this.$element.show(); | 277 | this.$el.show(); |
424 | 278 | this.getParent().$element.addClass('oe_wait'); | 278 | this.getParent().$el.addClass('oe_wait'); |
425 | 279 | } else { | 279 | } else { |
426 | 280 | this.count = 0; | 280 | this.count = 0; |
427 | 281 | clearTimeout(this.long_running_timer); | 281 | clearTimeout(this.long_running_timer); |
428 | @@ -284,8 +284,8 @@ | |||
429 | 284 | this.blocked_ui = false; | 284 | this.blocked_ui = false; |
430 | 285 | instance.web.unblockUI(); | 285 | instance.web.unblockUI(); |
431 | 286 | } | 286 | } |
434 | 287 | this.$element.fadeOut(); | 287 | this.$el.fadeOut(); |
435 | 288 | this.getParent().$element.removeClass('oe_wait'); | 288 | this.getParent().$el.removeClass('oe_wait'); |
436 | 289 | } | 289 | } |
437 | 290 | } | 290 | } |
438 | 291 | }); | 291 | }); |
439 | @@ -317,7 +317,7 @@ | |||
440 | 317 | do_render: function() { | 317 | do_render: function() { |
441 | 318 | var self = this; | 318 | var self = this; |
442 | 319 | instance.webclient.toggle_bars(true); | 319 | instance.webclient.toggle_bars(true); |
444 | 320 | self.$element.html(QWeb.render("DatabaseManager", { widget : self })); | 320 | self.$el.html(QWeb.render("DatabaseManager", { widget : self })); |
445 | 321 | $('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self })); | 321 | $('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self })); |
446 | 322 | $('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self })); | 322 | $('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self })); |
447 | 323 | $('ul.oe_secondary_submenu > li:first').addClass('oe_active') | 323 | $('ul.oe_secondary_submenu > li:first').addClass('oe_active') |
448 | @@ -329,14 +329,14 @@ | |||
449 | 329 | event.preventDefault(); | 329 | event.preventDefault(); |
450 | 330 | }); | 330 | }); |
451 | 331 | $('#back-to-login').click(self.do_exit); | 331 | $('#back-to-login').click(self.do_exit); |
460 | 332 | self.$element.find("td").addClass("oe_form_group_cell"); | 332 | self.$el.find("td").addClass("oe_form_group_cell"); |
461 | 333 | self.$element.find("tr td:first-child").addClass("oe_form_group_cell_label"); | 333 | self.$el.find("tr td:first-child").addClass("oe_form_group_cell_label"); |
462 | 334 | self.$element.find("label").addClass("oe_form_label"); | 334 | self.$el.find("label").addClass("oe_form_label"); |
463 | 335 | self.$element.find("form[name=create_db_form]").validate({ submitHandler: self.do_create }); | 335 | self.$el.find("form[name=create_db_form]").validate({ submitHandler: self.do_create }); |
464 | 336 | self.$element.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop }); | 336 | self.$el.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop }); |
465 | 337 | self.$element.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup }); | 337 | self.$el.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup }); |
466 | 338 | self.$element.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore }); | 338 | self.$el.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore }); |
467 | 339 | self.$element.find("form[name=change_pwd_form]").validate({ | 339 | self.$el.find("form[name=change_pwd_form]").validate({ |
468 | 340 | messages: { | 340 | messages: { |
469 | 341 | old_pwd: "Please enter your previous password", | 341 | old_pwd: "Please enter your previous password", |
470 | 342 | new_pwd: "Please enter your new password", | 342 | new_pwd: "Please enter your new password", |
471 | @@ -349,7 +349,7 @@ | |||
472 | 349 | }); | 349 | }); |
473 | 350 | }, | 350 | }, |
474 | 351 | destroy: function () { | 351 | destroy: function () { |
476 | 352 | this.$element.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty(); | 352 | this.$el.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty(); |
477 | 353 | this._super(); | 353 | this._super(); |
478 | 354 | }, | 354 | }, |
479 | 355 | /** | 355 | /** |
480 | @@ -500,7 +500,7 @@ | |||
481 | 500 | }); | 500 | }); |
482 | 501 | }, | 501 | }, |
483 | 502 | do_exit: function () { | 502 | do_exit: function () { |
485 | 503 | this.$element.remove(); | 503 | this.$el.remove(); |
486 | 504 | instance.webclient.toggle_bars(false); | 504 | instance.webclient.toggle_bars(false); |
487 | 505 | this.do_action('login'); | 505 | this.do_action('login'); |
488 | 506 | } | 506 | } |
489 | @@ -533,8 +533,8 @@ | |||
490 | 533 | }, | 533 | }, |
491 | 534 | start: function() { | 534 | start: function() { |
492 | 535 | var self = this; | 535 | var self = this; |
495 | 536 | self.$element.find("form").submit(self.on_submit); | 536 | self.$el.find("form").submit(self.on_submit); |
496 | 537 | self.$element.find('.oe_login_manage_db').click(function() { | 537 | self.$el.find('.oe_login_manage_db').click(function() { |
497 | 538 | self.do_action("database_manager"); | 538 | self.do_action("database_manager"); |
498 | 539 | }); | 539 | }); |
499 | 540 | var d; | 540 | var d; |
500 | @@ -584,7 +584,7 @@ | |||
501 | 584 | */ | 584 | */ |
502 | 585 | do_login: function (db, login, password) { | 585 | do_login: function (db, login, password) { |
503 | 586 | var self = this; | 586 | var self = this; |
505 | 587 | this.$element.removeClass('oe_login_invalid'); | 587 | this.$el.removeClass('oe_login_invalid'); |
506 | 588 | self.$(".oe_login_pane").fadeOut("slow"); | 588 | self.$(".oe_login_pane").fadeOut("slow"); |
507 | 589 | return this.session.session_authenticate(db, login, password).pipe(function() { | 589 | return this.session.session_authenticate(db, login, password).pipe(function() { |
508 | 590 | if (self.has_local_storage) { | 590 | if (self.has_local_storage) { |
509 | @@ -603,7 +603,7 @@ | |||
510 | 603 | self.trigger('login_successful'); | 603 | self.trigger('login_successful'); |
511 | 604 | },function () { | 604 | },function () { |
512 | 605 | self.$(".oe_login_pane").fadeIn("fast", function() { | 605 | self.$(".oe_login_pane").fadeIn("fast", function() { |
514 | 606 | self.$element.addClass("oe_login_invalid"); | 606 | self.$el.addClass("oe_login_invalid"); |
515 | 607 | }); | 607 | }); |
516 | 608 | }); | 608 | }); |
517 | 609 | }, | 609 | }, |
518 | @@ -663,7 +663,7 @@ | |||
519 | 663 | template: "ChangePassword", | 663 | template: "ChangePassword", |
520 | 664 | start: function() { | 664 | start: function() { |
521 | 665 | var self = this; | 665 | var self = this; |
523 | 666 | self.$element.validate({ | 666 | self.$el.validate({ |
524 | 667 | submitHandler: function (form) { | 667 | submitHandler: function (form) { |
525 | 668 | self.rpc("/web/session/change_password",{ | 668 | self.rpc("/web/session/change_password",{ |
526 | 669 | 'fields': $(form).serializeArray() | 669 | 'fields': $(form).serializeArray() |
527 | @@ -700,7 +700,7 @@ | |||
528 | 700 | }, | 700 | }, |
529 | 701 | start: function() { | 701 | start: function() { |
530 | 702 | this._super.apply(this, arguments); | 702 | this._super.apply(this, arguments); |
532 | 703 | this.$secondary_menus = this.getParent().$element.find('.oe_secondary_menus_container'); | 703 | this.$secondary_menus = this.getParent().$el.find('.oe_secondary_menus_container'); |
533 | 704 | this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click); | 704 | this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click); |
534 | 705 | return this.do_reload(); | 705 | return this.do_reload(); |
535 | 706 | }, | 706 | }, |
536 | @@ -718,7 +718,7 @@ | |||
537 | 718 | $toplevel.hide(); | 718 | $toplevel.hide(); |
538 | 719 | } | 719 | } |
539 | 720 | this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this })); | 720 | this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this })); |
541 | 721 | this.$element.on('click', 'a[data-menu]', this.on_menu_click); | 721 | this.$el.on('click', 'a[data-menu]', this.on_menu_click); |
542 | 722 | // Hide second level submenus | 722 | // Hide second level submenus |
543 | 723 | this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide(); | 723 | this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide(); |
544 | 724 | if (self.current_menu) { | 724 | if (self.current_menu) { |
545 | @@ -733,7 +733,7 @@ | |||
546 | 733 | } | 733 | } |
547 | 734 | if (maximum_visible_links < this.data.data.children.length) { | 734 | if (maximum_visible_links < this.data.data.children.length) { |
548 | 735 | var $more = $(QWeb.render('Menu.more')), | 735 | var $more = $(QWeb.render('Menu.more')), |
550 | 736 | $index = this.$element.find('li').eq(maximum_visible_links - 1); | 736 | $index = this.$el.find('li').eq(maximum_visible_links - 1); |
551 | 737 | $index.after($more); | 737 | $index.after($more); |
552 | 738 | //$('.oe_topbar').append($more); | 738 | //$('.oe_topbar').append($more); |
553 | 739 | $more.find('.oe_menu_more').append($index.next().nextAll()); | 739 | $more.find('.oe_menu_more').append($index.next().nextAll()); |
554 | @@ -752,19 +752,19 @@ | |||
555 | 752 | */ | 752 | */ |
556 | 753 | open_menu: function (id) { | 753 | open_menu: function (id) { |
557 | 754 | var $clicked_menu, $sub_menu, $main_menu; | 754 | var $clicked_menu, $sub_menu, $main_menu; |
559 | 755 | $clicked_menu = this.$element.add(this.$secondary_menus).find('a[data-menu=' + id + ']'); | 755 | $clicked_menu = this.$el.add(this.$secondary_menus).find('a[data-menu=' + id + ']'); |
560 | 756 | this.trigger('open_menu', id, $clicked_menu); | 756 | this.trigger('open_menu', id, $clicked_menu); |
561 | 757 | 757 | ||
562 | 758 | if (this.$secondary_menus.has($clicked_menu).length) { | 758 | if (this.$secondary_menus.has($clicked_menu).length) { |
563 | 759 | $sub_menu = $clicked_menu.parents('.oe_secondary_menu'); | 759 | $sub_menu = $clicked_menu.parents('.oe_secondary_menu'); |
565 | 760 | $main_menu = this.$element.find('a[data-menu=' + $sub_menu.data('menu-parent') + ']'); | 760 | $main_menu = this.$el.find('a[data-menu=' + $sub_menu.data('menu-parent') + ']'); |
566 | 761 | } else { | 761 | } else { |
567 | 762 | $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + $clicked_menu.attr('data-menu') + ']'); | 762 | $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + $clicked_menu.attr('data-menu') + ']'); |
568 | 763 | $main_menu = $clicked_menu; | 763 | $main_menu = $clicked_menu; |
569 | 764 | } | 764 | } |
570 | 765 | 765 | ||
571 | 766 | // Activate current main menu | 766 | // Activate current main menu |
573 | 767 | this.$element.find('.oe_active').removeClass('oe_active'); | 767 | this.$el.find('.oe_active').removeClass('oe_active'); |
574 | 768 | $main_menu.addClass('oe_active'); | 768 | $main_menu.addClass('oe_active'); |
575 | 769 | 769 | ||
576 | 770 | // Show current sub menu | 770 | // Show current sub menu |
577 | @@ -791,7 +791,7 @@ | |||
578 | 791 | * @param {Number} id the action_id to match | 791 | * @param {Number} id the action_id to match |
579 | 792 | */ | 792 | */ |
580 | 793 | open_action: function (id) { | 793 | open_action: function (id) { |
582 | 794 | var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]'); | 794 | var $menu = this.$el.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]'); |
583 | 795 | var menu_id = $menu.data('menu'); | 795 | var menu_id = $menu.data('menu'); |
584 | 796 | if (menu_id) { | 796 | if (menu_id) { |
585 | 797 | this.open_menu(menu_id); | 797 | this.open_menu(menu_id); |
586 | @@ -807,14 +807,14 @@ | |||
587 | 807 | if (!id) { return; } | 807 | if (!id) { return; } |
588 | 808 | 808 | ||
589 | 809 | // find back the menuitem in dom to get the action | 809 | // find back the menuitem in dom to get the action |
591 | 810 | var $item = this.$element.find('a[data-menu=' + id + ']'); | 810 | var $item = this.$el.find('a[data-menu=' + id + ']'); |
592 | 811 | if (!$item.length) { | 811 | if (!$item.length) { |
593 | 812 | $item = this.$secondary_menus.find('a[data-menu=' + id + ']'); | 812 | $item = this.$secondary_menus.find('a[data-menu=' + id + ']'); |
594 | 813 | } | 813 | } |
595 | 814 | var action_id = $item.data('action-id'); | 814 | var action_id = $item.data('action-id'); |
596 | 815 | // If first level menu doesnt have action trigger first leaf | 815 | // If first level menu doesnt have action trigger first leaf |
597 | 816 | if (!action_id) { | 816 | if (!action_id) { |
599 | 817 | if(this.$element.has($item).length) { | 817 | if(this.$el.has($item).length) { |
600 | 818 | var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']'); | 818 | var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']'); |
601 | 819 | var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]'); | 819 | var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]'); |
602 | 820 | if($items.length) { | 820 | if($items.length) { |
603 | @@ -855,7 +855,7 @@ | |||
604 | 855 | start: function() { | 855 | start: function() { |
605 | 856 | var self = this; | 856 | var self = this; |
606 | 857 | this._super.apply(this, arguments); | 857 | this._super.apply(this, arguments); |
608 | 858 | this.$element.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) { | 858 | this.$el.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) { |
609 | 859 | ev.preventDefault(); | 859 | ev.preventDefault(); |
610 | 860 | var f = self['on_menu_' + $(this).data('menu')]; | 860 | var f = self['on_menu_' + $(this).data('menu')]; |
611 | 861 | if (f) { | 861 | if (f) { |
612 | @@ -866,7 +866,7 @@ | |||
613 | 866 | do_update: function () { | 866 | do_update: function () { |
614 | 867 | var self = this; | 867 | var self = this; |
615 | 868 | var fct = function() { | 868 | var fct = function() { |
617 | 869 | var $avatar = self.$element.find('.oe_topbar_avatar'); | 869 | var $avatar = self.$el.find('.oe_topbar_avatar'); |
618 | 870 | $avatar.attr('src', $avatar.data('default-src')); | 870 | $avatar.attr('src', $avatar.data('default-src')); |
619 | 871 | if (!self.session.uid) | 871 | if (!self.session.uid) |
620 | 872 | return; | 872 | return; |
621 | @@ -877,7 +877,7 @@ | |||
622 | 877 | topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db); | 877 | topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db); |
623 | 878 | if(res.company_id[0] > 1) | 878 | if(res.company_id[0] > 1) |
624 | 879 | topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]); | 879 | topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]); |
626 | 880 | self.$element.find('.oe_topbar_name').text(topbar_name); | 880 | self.$el.find('.oe_topbar_name').text(topbar_name); |
627 | 881 | 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); | 881 | 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 | 882 | $avatar.attr('src', avatar_src); | 882 | $avatar.attr('src', avatar_src); |
629 | 883 | }); | 883 | }); |
630 | @@ -927,10 +927,10 @@ | |||
631 | 927 | }, | 927 | }, |
632 | 928 | bind_events: function() { | 928 | bind_events: function() { |
633 | 929 | var self = this; | 929 | var self = this; |
635 | 930 | this.$element.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() { | 930 | this.$el.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() { |
636 | 931 | $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter'); | 931 | $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter'); |
637 | 932 | }); | 932 | }); |
639 | 933 | this.$element.on('click', '.oe_dropdown_toggle', function(ev) { | 933 | this.$el.on('click', '.oe_dropdown_toggle', function(ev) { |
640 | 934 | ev.preventDefault(); | 934 | ev.preventDefault(); |
641 | 935 | var $toggle = $(this); | 935 | var $toggle = $(this); |
642 | 936 | var $menu = $toggle.siblings('.oe_dropdown_menu'); | 936 | var $menu = $toggle.siblings('.oe_dropdown_menu'); |
643 | @@ -954,7 +954,7 @@ | |||
644 | 954 | instance.web.bus.on('click', this, function(ev) { | 954 | instance.web.bus.on('click', this, function(ev) { |
645 | 955 | $.fn.tipsy.clear(); | 955 | $.fn.tipsy.clear(); |
646 | 956 | if (!$(ev.target).is('input[type=file]')) { | 956 | if (!$(ev.target).is('input[type=file]')) { |
648 | 957 | self.$element.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened'); | 957 | self.$el.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened'); |
649 | 958 | } | 958 | } |
650 | 959 | }); | 959 | }); |
651 | 960 | }, | 960 | }, |
652 | @@ -963,9 +963,9 @@ | |||
653 | 963 | this.crashmanager = new instance.web.CrashManager(); | 963 | this.crashmanager = new instance.web.CrashManager(); |
654 | 964 | instance.session.on_rpc_error.add(this.crashmanager.on_rpc_error); | 964 | instance.session.on_rpc_error.add(this.crashmanager.on_rpc_error); |
655 | 965 | self.notification = new instance.web.Notification(this); | 965 | self.notification = new instance.web.Notification(this); |
657 | 966 | self.notification.appendTo(self.$element); | 966 | self.notification.appendTo(self.$el); |
658 | 967 | self.loading = new instance.web.Loading(self); | 967 | self.loading = new instance.web.Loading(self); |
660 | 968 | self.loading.appendTo(self.$element); | 968 | self.loading.appendTo(self.$el); |
661 | 969 | self.action_manager = new instance.web.ActionManager(self); | 969 | self.action_manager = new instance.web.ActionManager(self); |
662 | 970 | self.action_manager.appendTo(self.$('.oe_application')); | 970 | self.action_manager.appendTo(self.$('.oe_application')); |
663 | 971 | }, | 971 | }, |
664 | @@ -1035,17 +1035,17 @@ | |||
665 | 1035 | var self = this; | 1035 | var self = this; |
666 | 1036 | self.toggle_bars(true); | 1036 | self.toggle_bars(true); |
667 | 1037 | self.menu = new instance.web.Menu(self); | 1037 | self.menu = new instance.web.Menu(self); |
669 | 1038 | self.menu.replace(this.$element.find('.oe_menu_placeholder')); | 1038 | self.menu.replace(this.$el.find('.oe_menu_placeholder')); |
670 | 1039 | self.menu.on('menu_click', this, this.on_menu_action); | 1039 | self.menu.on('menu_click', this, this.on_menu_action); |
671 | 1040 | self.user_menu = new instance.web.UserMenu(self); | 1040 | self.user_menu = new instance.web.UserMenu(self); |
673 | 1041 | self.user_menu.replace(this.$element.find('.oe_user_menu_placeholder')); | 1041 | self.user_menu.replace(this.$el.find('.oe_user_menu_placeholder')); |
674 | 1042 | self.user_menu.on_menu_logout.add(this.proxy('on_logout')); | 1042 | self.user_menu.on_menu_logout.add(this.proxy('on_logout')); |
675 | 1043 | self.user_menu.on_action.add(this.proxy('on_menu_action')); | 1043 | self.user_menu.on_action.add(this.proxy('on_menu_action')); |
676 | 1044 | self.user_menu.do_update(); | 1044 | self.user_menu.do_update(); |
677 | 1045 | self.bind_hashchange(); | 1045 | self.bind_hashchange(); |
678 | 1046 | if (!self.session.openerp_entreprise) { | 1046 | if (!self.session.openerp_entreprise) { |
679 | 1047 | var version_label = _t("OpenERP - Unsupported/Community Version"); | 1047 | var version_label = _t("OpenERP - Unsupported/Community Version"); |
681 | 1048 | 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)); | 1048 | 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 | 1049 | } | 1049 | } |
683 | 1050 | self.set_title(); | 1050 | self.set_title(); |
684 | 1051 | }, | 1051 | }, |
685 | @@ -1053,7 +1053,7 @@ | |||
686 | 1053 | _.each(_.clone(this.getChildren()), function(el) { | 1053 | _.each(_.clone(this.getChildren()), function(el) { |
687 | 1054 | el.destroy(); | 1054 | el.destroy(); |
688 | 1055 | }); | 1055 | }); |
690 | 1056 | this.$element.children().remove(); | 1056 | this.$el.children().remove(); |
691 | 1057 | }, | 1057 | }, |
692 | 1058 | do_reload: function() { | 1058 | do_reload: function() { |
693 | 1059 | var self = this; | 1059 | var self = this; |
694 | @@ -1085,7 +1085,7 @@ | |||
695 | 1085 | var state = $.bbq.getState(true); | 1085 | var state = $.bbq.getState(true); |
696 | 1086 | if (_.isEmpty(state) || state.action == "login") { | 1086 | if (_.isEmpty(state) || state.action == "login") { |
697 | 1087 | self.menu.has_been_loaded.then(function() { | 1087 | self.menu.has_been_loaded.then(function() { |
699 | 1088 | var first_menu_id = self.menu.$element.find("a:first").data("menu"); | 1088 | var first_menu_id = self.menu.$el.find("a:first").data("menu"); |
700 | 1089 | if(first_menu_id) { | 1089 | if(first_menu_id) { |
701 | 1090 | self.menu.menu_click(first_menu_id); | 1090 | self.menu.menu_click(first_menu_id); |
702 | 1091 | } | 1091 | } |
703 | @@ -1140,10 +1140,10 @@ | |||
704 | 1140 | }, | 1140 | }, |
705 | 1141 | set_content_full_screen: function(fullscreen) { | 1141 | set_content_full_screen: function(fullscreen) { |
706 | 1142 | if (fullscreen) { | 1142 | if (fullscreen) { |
708 | 1143 | $(".oe_webclient", this.$element).addClass("oe_content_full_screen"); | 1143 | $(".oe_webclient", this.$el).addClass("oe_content_full_screen"); |
709 | 1144 | $("body").css({'overflow-y':'hidden'}); | 1144 | $("body").css({'overflow-y':'hidden'}); |
710 | 1145 | } else { | 1145 | } else { |
712 | 1146 | $(".oe_webclient", this.$element).removeClass("oe_content_full_screen"); | 1146 | $(".oe_webclient", this.$el).removeClass("oe_content_full_screen"); |
713 | 1147 | $("body").css({'overflow-y':'scroll'}); | 1147 | $("body").css({'overflow-y':'scroll'}); |
714 | 1148 | } | 1148 | } |
715 | 1149 | } | 1149 | } |
716 | 1150 | 1150 | ||
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 | 525 | _.each(this.getChildren(), function(el) { | 525 | _.each(this.getChildren(), function(el) { |
722 | 526 | el.destroy(); | 526 | el.destroy(); |
723 | 527 | }); | 527 | }); |
726 | 528 | if(this.$element) { | 528 | if(this.$el) { |
727 | 529 | this.$element.remove(); | 529 | this.$el.remove(); |
728 | 530 | } | 530 | } |
729 | 531 | instance.web.PropertiesMixin.destroy.call(this); | 531 | instance.web.PropertiesMixin.destroy.call(this); |
730 | 532 | }, | 532 | }, |
731 | @@ -538,7 +538,7 @@ | |||
732 | 538 | appendTo: function(target) { | 538 | appendTo: function(target) { |
733 | 539 | var self = this; | 539 | var self = this; |
734 | 540 | return this.__widgetRenderAndInsert(function(t) { | 540 | return this.__widgetRenderAndInsert(function(t) { |
736 | 541 | self.$element.appendTo(t); | 541 | self.$el.appendTo(t); |
737 | 542 | }, target); | 542 | }, target); |
738 | 543 | }, | 543 | }, |
739 | 544 | /** | 544 | /** |
740 | @@ -549,7 +549,7 @@ | |||
741 | 549 | prependTo: function(target) { | 549 | prependTo: function(target) { |
742 | 550 | var self = this; | 550 | var self = this; |
743 | 551 | return this.__widgetRenderAndInsert(function(t) { | 551 | return this.__widgetRenderAndInsert(function(t) { |
745 | 552 | self.$element.prependTo(t); | 552 | self.$el.prependTo(t); |
746 | 553 | }, target); | 553 | }, target); |
747 | 554 | }, | 554 | }, |
748 | 555 | /** | 555 | /** |
749 | @@ -560,7 +560,7 @@ | |||
750 | 560 | insertAfter: function(target) { | 560 | insertAfter: function(target) { |
751 | 561 | var self = this; | 561 | var self = this; |
752 | 562 | return this.__widgetRenderAndInsert(function(t) { | 562 | return this.__widgetRenderAndInsert(function(t) { |
754 | 563 | self.$element.insertAfter(t); | 563 | self.$el.insertAfter(t); |
755 | 564 | }, target); | 564 | }, target); |
756 | 565 | }, | 565 | }, |
757 | 566 | /** | 566 | /** |
758 | @@ -571,7 +571,7 @@ | |||
759 | 571 | insertBefore: function(target) { | 571 | insertBefore: function(target) { |
760 | 572 | var self = this; | 572 | var self = this; |
761 | 573 | return this.__widgetRenderAndInsert(function(t) { | 573 | return this.__widgetRenderAndInsert(function(t) { |
763 | 574 | self.$element.insertBefore(t); | 574 | self.$el.insertBefore(t); |
764 | 575 | }, target); | 575 | }, target); |
765 | 576 | }, | 576 | }, |
766 | 577 | /** | 577 | /** |
767 | @@ -581,7 +581,7 @@ | |||
768 | 581 | */ | 581 | */ |
769 | 582 | replace: function(target) { | 582 | replace: function(target) { |
770 | 583 | return this.__widgetRenderAndInsert(_.bind(function(t) { | 583 | return this.__widgetRenderAndInsert(_.bind(function(t) { |
772 | 584 | this.$element.replaceAll(t); | 584 | this.$el.replaceAll(t); |
773 | 585 | }, this), target); | 585 | }, this), target); |
774 | 586 | }, | 586 | }, |
775 | 587 | __widgetRenderAndInsert: function(insertion, target) { | 587 | __widgetRenderAndInsert: function(insertion, target) { |
776 | @@ -640,8 +640,8 @@ | |||
777 | 640 | * // stuff that you want to init before the rendering | 640 | * // stuff that you want to init before the rendering |
778 | 641 | * }, | 641 | * }, |
779 | 642 | * start: function() { | 642 | * start: function() { |
782 | 643 | * // stuff you want to make after the rendering, `this.$element` holds a correct value | 643 | * // stuff you want to make after the rendering, `this.$el` holds a correct value |
783 | 644 | * this.$element.find(".my_button").click(/* an example of event binding * /); | 644 | * this.$el.find(".my_button").click(/* an example of event binding * /); |
784 | 645 | * | 645 | * |
785 | 646 | * // if you have some asynchronous operations, it's a good idea to return | 646 | * // if you have some asynchronous operations, it's a good idea to return |
786 | 647 | * // a promise in start() | 647 | * // a promise in start() |
787 | @@ -718,15 +718,15 @@ | |||
788 | 718 | * @returns {*} this | 718 | * @returns {*} this |
789 | 719 | */ | 719 | */ |
790 | 720 | replaceElement: function ($el) { | 720 | replaceElement: function ($el) { |
792 | 721 | var $oldel = this.$element; | 721 | var $oldel = this.$el; |
793 | 722 | this.setElement($el); | 722 | this.setElement($el); |
796 | 723 | if ($oldel && !$oldel.is(this.$element)) { | 723 | if ($oldel && !$oldel.is(this.$el)) { |
797 | 724 | $oldel.replaceWith(this.$element); | 724 | $oldel.replaceWith(this.$el); |
798 | 725 | } | 725 | } |
799 | 726 | return this; | 726 | return this; |
800 | 727 | }, | 727 | }, |
801 | 728 | /** | 728 | /** |
803 | 729 | * Re-sets the widget's root element (el/$el/$element). | 729 | * Re-sets the widget's root element (el/$el/$el). |
804 | 730 | * | 730 | * |
805 | 731 | * Includes: | 731 | * Includes: |
806 | 732 | * * re-delegating events | 732 | * * re-delegating events |
807 | @@ -738,14 +738,14 @@ | |||
808 | 738 | * @return {*} this | 738 | * @return {*} this |
809 | 739 | */ | 739 | */ |
810 | 740 | setElement: function (element) { | 740 | setElement: function (element) { |
812 | 741 | // NB: completely useless, as WidgetMixin#init creates a $element | 741 | // NB: completely useless, as WidgetMixin#init creates a $el |
813 | 742 | // always | 742 | // always |
815 | 743 | if (this.$element) { | 743 | if (this.$el) { |
816 | 744 | this.undelegateEvents(); | 744 | this.undelegateEvents(); |
817 | 745 | } | 745 | } |
818 | 746 | 746 | ||
821 | 747 | this.$element = (element instanceof $) ? element : $(element); | 747 | this.$el = (element instanceof $) ? element : $(element); |
822 | 748 | this.el = this.$element[0]; | 748 | this.el = this.$el[0]; |
823 | 749 | 749 | ||
824 | 750 | this.delegateEvents(); | 750 | this.delegateEvents(); |
825 | 751 | 751 | ||
826 | @@ -797,23 +797,23 @@ | |||
827 | 797 | 797 | ||
828 | 798 | event += '.widget_events'; | 798 | event += '.widget_events'; |
829 | 799 | if (!selector) { | 799 | if (!selector) { |
831 | 800 | this.$element.on(event, method); | 800 | this.$el.on(event, method); |
832 | 801 | } else { | 801 | } else { |
834 | 802 | this.$element.on(event, selector, method); | 802 | this.$el.on(event, selector, method); |
835 | 803 | } | 803 | } |
836 | 804 | } | 804 | } |
837 | 805 | }, | 805 | }, |
838 | 806 | undelegateEvents: function () { | 806 | undelegateEvents: function () { |
840 | 807 | this.$element.off('.widget_events'); | 807 | this.$el.off('.widget_events'); |
841 | 808 | }, | 808 | }, |
842 | 809 | /** | 809 | /** |
844 | 810 | * Shortcut for ``this.$element.find(selector)`` | 810 | * Shortcut for ``this.$el.find(selector)`` |
845 | 811 | * | 811 | * |
846 | 812 | * @param {String} selector CSS selector, rooted in $el | 812 | * @param {String} selector CSS selector, rooted in $el |
847 | 813 | * @returns {jQuery} selector match | 813 | * @returns {jQuery} selector match |
848 | 814 | */ | 814 | */ |
849 | 815 | $: function(selector) { | 815 | $: function(selector) { |
851 | 816 | return this.$element.find(selector); | 816 | return this.$el.find(selector); |
852 | 817 | }, | 817 | }, |
853 | 818 | /** | 818 | /** |
854 | 819 | * Informs the action manager to do an action. This supposes that | 819 | * Informs the action manager to do an action. This supposes that |
855 | 820 | 820 | ||
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 | 520 | return old_async_when.apply(this, arguments); | 520 | return old_async_when.apply(this, arguments); |
861 | 521 | }; | 521 | }; |
862 | 522 | 522 | ||
863 | 523 | /** Setup blockui */ | ||
864 | 524 | if ($.blockUI) { | ||
865 | 525 | $.blockUI.defaults.baseZ = 1100; | ||
866 | 526 | $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">'; | ||
867 | 527 | $.blockUI.defaults.css.border = '0'; | ||
868 | 528 | $.blockUI.defaults.css["background-color"] = ''; | ||
869 | 529 | } | ||
870 | 530 | |||
871 | 531 | var messages_by_seconds = [ | ||
872 | 532 | [0, "Loading..."], | ||
873 | 533 | [30, "Still Loading..."], | ||
874 | 534 | [60, "Still Loading...<br />Please be patient."], | ||
875 | 535 | [120, "Hey, guess what?<br />It's still loading."], | ||
876 | 536 | [300, "You may not believe it,<br/>but the application is actually loading..."], | ||
877 | 537 | ]; | ||
878 | 538 | |||
879 | 539 | instance.web.Throbber = instance.web.Widget.extend({ | ||
880 | 540 | template: "Throbber", | ||
881 | 541 | start: function() { | ||
882 | 542 | var opts = { | ||
883 | 543 | lines: 13, // The number of lines to draw | ||
884 | 544 | length: 7, // The length of each line | ||
885 | 545 | width: 4, // The line thickness | ||
886 | 546 | radius: 10, // The radius of the inner circle | ||
887 | 547 | rotate: 0, // The rotation offset | ||
888 | 548 | color: '#FFF', // #rgb or #rrggbb | ||
889 | 549 | speed: 1, // Rounds per second | ||
890 | 550 | trail: 60, // Afterglow percentage | ||
891 | 551 | shadow: false, // Whether to render a shadow | ||
892 | 552 | hwaccel: false, // Whether to use hardware acceleration | ||
893 | 553 | className: 'spinner', // The CSS class to assign to the spinner | ||
894 | 554 | zIndex: 2e9, // The z-index (defaults to 2000000000) | ||
895 | 555 | top: 'auto', // Top position relative to parent in px | ||
896 | 556 | left: 'auto' // Left position relative to parent in px | ||
897 | 557 | }; | ||
898 | 558 | this.spin = new Spinner(opts).spin(this.$element[0]); | ||
899 | 559 | this.start_time = new Date().getTime(); | ||
900 | 560 | this.act_message(); | ||
901 | 561 | }, | ||
902 | 562 | act_message: function() { | ||
903 | 563 | var self = this; | ||
904 | 564 | setTimeout(function() { | ||
905 | 565 | if (self.isDestroyed()) | ||
906 | 566 | return; | ||
907 | 567 | var seconds = (new Date().getTime() - self.start_time) / 1000; | ||
908 | 568 | var mes; | ||
909 | 569 | _.each(messages_by_seconds, function(el) { | ||
910 | 570 | if (seconds >= el[0]) | ||
911 | 571 | mes = el[1]; | ||
912 | 572 | }); | ||
913 | 573 | self.$(".oe_throbber_message").html(mes); | ||
914 | 574 | self.act_message(); | ||
915 | 575 | }, 1000); | ||
916 | 576 | }, | ||
917 | 577 | destroy: function() { | ||
918 | 578 | if (this.spin) | ||
919 | 579 | this.spin.stop(); | ||
920 | 580 | this._super(); | ||
921 | 581 | }, | ||
922 | 582 | }); | ||
923 | 583 | instance.web.Throbber.throbbers = []; | ||
924 | 584 | |||
925 | 585 | instance.web.blockUI = function() { | ||
926 | 586 | var tmp = $.blockUI.apply($, arguments); | ||
927 | 587 | var throbber = new instance.web.Throbber(); | ||
928 | 588 | instance.web.Throbber.throbbers.push(throbber); | ||
929 | 589 | throbber.appendTo($(".oe_blockui_spin_container")); | ||
930 | 590 | return tmp; | ||
931 | 591 | } | ||
932 | 592 | instance.web.unblockUI = function() { | ||
933 | 593 | _.each(instance.web.Throbber.throbbers, function(el) { | ||
934 | 594 | el.destroy(); | ||
935 | 595 | }); | ||
936 | 596 | return $.unblockUI.apply($, arguments); | ||
937 | 597 | } | ||
938 | 598 | |||
939 | 599 | /** Setup default session */ | 523 | /** Setup default session */ |
940 | 600 | instance.session = new instance.web.Session(); | 524 | instance.session = new instance.web.Session(); |
941 | 601 | 525 | ||
942 | @@ -679,6 +603,86 @@ | |||
943 | 679 | $.timeago.settings.translator = instance.web._t; | 603 | $.timeago.settings.translator = instance.web._t; |
944 | 680 | }); | 604 | }); |
945 | 681 | 605 | ||
946 | 606 | /** Setup blockui */ | ||
947 | 607 | if ($.blockUI) { | ||
948 | 608 | $.blockUI.defaults.baseZ = 1100; | ||
949 | 609 | $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">'; | ||
950 | 610 | $.blockUI.defaults.css.border = '0'; | ||
951 | 611 | $.blockUI.defaults.css["background-color"] = ''; | ||
952 | 612 | } | ||
953 | 613 | |||
954 | 614 | var messages_by_seconds = function() { | ||
955 | 615 | return [ | ||
956 | 616 | [0, _t("Loading...")], | ||
957 | 617 | [30, _t("Still loading...")], | ||
958 | 618 | [60, _t("Still loading...<br />Please be patient.")], | ||
959 | 619 | [120, _t("Don't leave yet,<br />it's still loading...")], | ||
960 | 620 | [300, _t("You may not believe it,<br />but the application is actually loading...")], | ||
961 | 621 | [600, _t("You know, sometimes,<br />OpenERP can be a little bit slow,<br />because it's loading...")], | ||
962 | 622 | [3600, _t("Maybe you should consider pressing F5...")], | ||
963 | 623 | ]; | ||
964 | 624 | }; | ||
965 | 625 | |||
966 | 626 | instance.web.Throbber = instance.web.Widget.extend({ | ||
967 | 627 | template: "Throbber", | ||
968 | 628 | start: function() { | ||
969 | 629 | var opts = { | ||
970 | 630 | lines: 13, // The number of lines to draw | ||
971 | 631 | length: 7, // The length of each line | ||
972 | 632 | width: 4, // The line thickness | ||
973 | 633 | radius: 10, // The radius of the inner circle | ||
974 | 634 | rotate: 0, // The rotation offset | ||
975 | 635 | color: '#FFF', // #rgb or #rrggbb | ||
976 | 636 | speed: 1, // Rounds per second | ||
977 | 637 | trail: 60, // Afterglow percentage | ||
978 | 638 | shadow: false, // Whether to render a shadow | ||
979 | 639 | hwaccel: false, // Whether to use hardware acceleration | ||
980 | 640 | className: 'spinner', // The CSS class to assign to the spinner | ||
981 | 641 | zIndex: 2e9, // The z-index (defaults to 2000000000) | ||
982 | 642 | top: 'auto', // Top position relative to parent in px | ||
983 | 643 | left: 'auto' // Left position relative to parent in px | ||
984 | 644 | }; | ||
985 | 645 | this.spin = new Spinner(opts).spin(this.$el[0]); | ||
986 | 646 | this.start_time = new Date().getTime(); | ||
987 | 647 | this.act_message(); | ||
988 | 648 | }, | ||
989 | 649 | act_message: function() { | ||
990 | 650 | var self = this; | ||
991 | 651 | setTimeout(function() { | ||
992 | 652 | if (self.isDestroyed()) | ||
993 | 653 | return; | ||
994 | 654 | var seconds = (new Date().getTime() - self.start_time) / 1000; | ||
995 | 655 | var mes; | ||
996 | 656 | _.each(messages_by_seconds(), function(el) { | ||
997 | 657 | if (seconds >= el[0]) | ||
998 | 658 | mes = el[1]; | ||
999 | 659 | }); | ||
1000 | 660 | self.$(".oe_throbber_message").html(mes); | ||
1001 | 661 | self.act_message(); | ||
1002 | 662 | }, 1000); | ||
1003 | 663 | }, | ||
1004 | 664 | destroy: function() { | ||
1005 | 665 | if (this.spin) | ||
1006 | 666 | this.spin.stop(); | ||
1007 | 667 | this._super(); | ||
1008 | 668 | }, | ||
1009 | 669 | }); | ||
1010 | 670 | instance.web.Throbber.throbbers = []; | ||
1011 | 671 | |||
1012 | 672 | instance.web.blockUI = function() { | ||
1013 | 673 | var tmp = $.blockUI.apply($, arguments); | ||
1014 | 674 | var throbber = new instance.web.Throbber(); | ||
1015 | 675 | instance.web.Throbber.throbbers.push(throbber); | ||
1016 | 676 | throbber.appendTo($(".oe_blockui_spin_container")); | ||
1017 | 677 | return tmp; | ||
1018 | 678 | } | ||
1019 | 679 | instance.web.unblockUI = function() { | ||
1020 | 680 | _.each(instance.web.Throbber.throbbers, function(el) { | ||
1021 | 681 | el.destroy(); | ||
1022 | 682 | }); | ||
1023 | 683 | return $.unblockUI.apply($, arguments); | ||
1024 | 684 | } | ||
1025 | 685 | |||
1026 | 682 | /** | 686 | /** |
1027 | 683 | * Registry for all the client actions key: tag value: widget | 687 | * Registry for all the client actions key: tag value: widget |
1028 | 684 | */ | 688 | */ |
1029 | 685 | 689 | ||
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 | 21 | ], | 21 | ], |
1035 | 22 | close: function(event, ui){ self.close();} | 22 | close: function(event, ui){ self.close();} |
1036 | 23 | }); | 23 | }); |
1039 | 24 | self.$element.removeClass('ui-dialog-content ui-widget-content'); | 24 | self.$el.removeClass('ui-dialog-content ui-widget-content'); |
1040 | 25 | self.$element.find('#add_field').click(function() { | 25 | self.$el.find('#add_field').click(function() { |
1041 | 26 | if ($('#field-tree-structure tr.ui-selected')) { | 26 | if ($('#field-tree-structure tr.ui-selected')) { |
1043 | 27 | var fld = self.$element.find('#field-tree-structure tr.ui-selected').find('a'); | 27 | var fld = self.$el.find('#field-tree-structure tr.ui-selected').find('a'); |
1044 | 28 | for (var i = 0; i < fld.length; i++) { | 28 | for (var i = 0; i < fld.length; i++) { |
1045 | 29 | var id = $(fld[i]).attr('id').split('-')[1]; | 29 | var id = $(fld[i]).attr('id').split('-')[1]; |
1046 | 30 | var string = $(fld[i]).attr('string'); | 30 | var string = $(fld[i]).attr('string'); |
1047 | 31 | self.add_field(id, string); | 31 | self.add_field(id, string); |
1048 | 32 | } | 32 | } |
1050 | 33 | self.$element.find('#field-tree-structure tr').removeClass('ui-selected'); | 33 | self.$el.find('#field-tree-structure tr').removeClass('ui-selected'); |
1051 | 34 | } | 34 | } |
1052 | 35 | }); | 35 | }); |
1060 | 36 | self.$element.find('#remove_field').click(function() { | 36 | self.$el.find('#remove_field').click(function() { |
1061 | 37 | self.$element.find('#fields_list option:selected').remove(); | 37 | self.$el.find('#fields_list option:selected').remove(); |
1062 | 38 | }); | 38 | }); |
1063 | 39 | self.$element.find('#remove_all_field').click(function() { | 39 | self.$el.find('#remove_all_field').click(function() { |
1064 | 40 | self.$element.find('#fields_list').empty(); | 40 | self.$el.find('#fields_list').empty(); |
1065 | 41 | }); | 41 | }); |
1066 | 42 | this.$element.find('#export_new_list').click(this.on_show_save_list); | 42 | this.$el.find('#export_new_list').click(this.on_show_save_list); |
1067 | 43 | 43 | ||
1068 | 44 | var got_fields = new $.Deferred(); | 44 | var got_fields = new $.Deferred(); |
1073 | 45 | this.$element.find('#import_compat').change(function() { | 45 | this.$el.find('#import_compat').change(function() { |
1074 | 46 | self.$element.find('#fields_list').empty(); | 46 | self.$el.find('#fields_list').empty(); |
1075 | 47 | self.$element.find('#field-tree-structure').remove(); | 47 | self.$el.find('#field-tree-structure').remove(); |
1076 | 48 | var import_comp = self.$element.find("#import_compat").val(); | 48 | var import_comp = self.$el.find("#import_compat").val(); |
1077 | 49 | self.rpc("/web/export/get_fields", { | 49 | self.rpc("/web/export/get_fields", { |
1078 | 50 | model: self.dataset.model, | 50 | model: self.dataset.model, |
1079 | 51 | import_compat: Boolean(import_comp) | 51 | import_compat: Boolean(import_comp) |
1080 | @@ -61,7 +61,7 @@ | |||
1081 | 61 | this.show_exports_list()); | 61 | this.show_exports_list()); |
1082 | 62 | }, | 62 | }, |
1083 | 63 | do_setup_export_formats: function (formats) { | 63 | do_setup_export_formats: function (formats) { |
1085 | 64 | var $fmts = this.$element.find('#export_format'); | 64 | var $fmts = this.$el.find('#export_format'); |
1086 | 65 | _(formats).each(function (format) { | 65 | _(formats).each(function (format) { |
1087 | 66 | var opt = new Option(format.label, format.tag); | 66 | var opt = new Option(format.label, format.tag); |
1088 | 67 | if (format.error) { | 67 | if (format.error) { |
1089 | @@ -76,8 +76,8 @@ | |||
1090 | 76 | }, | 76 | }, |
1091 | 77 | show_exports_list: function() { | 77 | show_exports_list: function() { |
1092 | 78 | var self = this; | 78 | var self = this; |
1095 | 79 | if (self.$element.find('#saved_export_list').is(':hidden')) { | 79 | if (self.$el.find('#saved_export_list').is(':hidden')) { |
1096 | 80 | self.$element.find('#ExistsExportList').show(); | 80 | self.$el.find('#ExistsExportList').show(); |
1097 | 81 | return; | 81 | return; |
1098 | 82 | } | 82 | } |
1099 | 83 | return this.exports.read_slice(['name'], { | 83 | return this.exports.read_slice(['name'], { |
1100 | @@ -86,35 +86,35 @@ | |||
1101 | 86 | if (!export_list.length) { | 86 | if (!export_list.length) { |
1102 | 87 | return; | 87 | return; |
1103 | 88 | } | 88 | } |
1108 | 89 | self.$element.find('#ExistsExportList').append(QWeb.render('Exists.ExportList', {'existing_exports': export_list})); | 89 | self.$el.find('#ExistsExportList').append(QWeb.render('Exists.ExportList', {'existing_exports': export_list})); |
1109 | 90 | self.$element.find('#saved_export_list').change(function() { | 90 | self.$el.find('#saved_export_list').change(function() { |
1110 | 91 | self.$element.find('#fields_list option').remove(); | 91 | self.$el.find('#fields_list option').remove(); |
1111 | 92 | var export_id = self.$element.find('#saved_export_list option:selected').val(); | 92 | var export_id = self.$el.find('#saved_export_list option:selected').val(); |
1112 | 93 | if (export_id) { | 93 | if (export_id) { |
1113 | 94 | self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}, self.do_load_export_field); | 94 | self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}, self.do_load_export_field); |
1114 | 95 | } | 95 | } |
1115 | 96 | }); | 96 | }); |
1118 | 97 | self.$element.find('#delete_export_list').click(function() { | 97 | self.$el.find('#delete_export_list').click(function() { |
1119 | 98 | var select_exp = self.$element.find('#saved_export_list option:selected'); | 98 | var select_exp = self.$el.find('#saved_export_list option:selected'); |
1120 | 99 | if (select_exp.val()) { | 99 | if (select_exp.val()) { |
1121 | 100 | self.exports.unlink([parseInt(select_exp.val(), 10)]); | 100 | self.exports.unlink([parseInt(select_exp.val(), 10)]); |
1122 | 101 | select_exp.remove(); | 101 | select_exp.remove(); |
1125 | 102 | if (self.$element.find('#saved_export_list option').length <= 1) { | 102 | if (self.$el.find('#saved_export_list option').length <= 1) { |
1126 | 103 | self.$element.find('#ExistsExportList').hide(); | 103 | self.$el.find('#ExistsExportList').hide(); |
1127 | 104 | } | 104 | } |
1128 | 105 | } | 105 | } |
1129 | 106 | }); | 106 | }); |
1130 | 107 | }); | 107 | }); |
1131 | 108 | }, | 108 | }, |
1132 | 109 | do_load_export_field: function(field_list) { | 109 | do_load_export_field: function(field_list) { |
1134 | 110 | var export_node = this.$element.find("#fields_list"); | 110 | var export_node = this.$el.find("#fields_list"); |
1135 | 111 | _(field_list).each(function (field) { | 111 | _(field_list).each(function (field) { |
1136 | 112 | export_node.append(new Option(field.label, field.name)); | 112 | export_node.append(new Option(field.label, field.name)); |
1137 | 113 | }); | 113 | }); |
1138 | 114 | }, | 114 | }, |
1139 | 115 | on_show_save_list: function() { | 115 | on_show_save_list: function() { |
1140 | 116 | var self = this; | 116 | var self = this; |
1142 | 117 | var current_node = self.$element.find("#savenewlist"); | 117 | var current_node = self.$el.find("#savenewlist"); |
1143 | 118 | if (!(current_node.find("label")).length) { | 118 | if (!(current_node.find("label")).length) { |
1144 | 119 | current_node.append(QWeb.render('ExportNewList')); | 119 | current_node.append(QWeb.render('ExportNewList')); |
1145 | 120 | current_node.find("#add_export_list").click(function() { | 120 | current_node.find("#add_export_list").click(function() { |
1146 | @@ -150,14 +150,14 @@ | |||
1147 | 150 | if (!export_list_id.result) { | 150 | if (!export_list_id.result) { |
1148 | 151 | return; | 151 | return; |
1149 | 152 | } | 152 | } |
1151 | 153 | self.$element.find("#saved_export_list").append( | 153 | self.$el.find("#saved_export_list").append( |
1152 | 154 | new Option(value, export_list_id.result)); | 154 | new Option(value, export_list_id.result)); |
1154 | 155 | if (self.$element.find("#saved_export_list").is(":hidden")) { | 155 | if (self.$el.find("#saved_export_list").is(":hidden")) { |
1155 | 156 | self.show_exports_list(); | 156 | self.show_exports_list(); |
1156 | 157 | } | 157 | } |
1157 | 158 | }); | 158 | }); |
1158 | 159 | this.on_show_save_list(); | 159 | this.on_show_save_list(); |
1160 | 160 | this.$element.find("#fields_list option").remove(); | 160 | this.$el.find("#fields_list option").remove(); |
1161 | 161 | }, | 161 | }, |
1162 | 162 | on_click: function(id, record) { | 162 | on_click: function(id, record) { |
1163 | 163 | var self = this; | 163 | var self = this; |
1164 | @@ -173,7 +173,7 @@ | |||
1165 | 173 | } | 173 | } |
1166 | 174 | 174 | ||
1167 | 175 | if (!record.loaded) { | 175 | if (!record.loaded) { |
1169 | 176 | var import_comp = self.$element.find("#import_compat").val(); | 176 | var import_comp = self.$el.find("#import_compat").val(); |
1170 | 177 | self.rpc("/web/export/get_fields", { | 177 | self.rpc("/web/export/get_fields", { |
1171 | 178 | model: model, | 178 | model: model, |
1172 | 179 | prefix: prefix, | 179 | prefix: prefix, |
1173 | @@ -191,44 +191,44 @@ | |||
1174 | 191 | }, | 191 | }, |
1175 | 192 | on_show_data: function(result, after) { | 192 | on_show_data: function(result, after) { |
1176 | 193 | var self = this; | 193 | var self = this; |
1178 | 194 | var imp_cmpt = Boolean(self.$element.find("#import_compat").val()); | 194 | var imp_cmpt = Boolean(self.$el.find("#import_compat").val()); |
1179 | 195 | 195 | ||
1180 | 196 | if (after) { | 196 | if (after) { |
1182 | 197 | var current_tr = self.$element.find("tr[id='treerow-" + after + "']"); | 197 | var current_tr = self.$el.find("tr[id='treerow-" + after + "']"); |
1183 | 198 | current_tr.addClass('open'); | 198 | current_tr.addClass('open'); |
1184 | 199 | current_tr.find('img').attr('src','/web/static/src/img/collapse.gif'); | 199 | current_tr.find('img').attr('src','/web/static/src/img/collapse.gif'); |
1185 | 200 | current_tr.after(QWeb.render('ExportTreeView-Secondary.children', {'fields': result})); | 200 | current_tr.after(QWeb.render('ExportTreeView-Secondary.children', {'fields': result})); |
1186 | 201 | } else { | 201 | } else { |
1188 | 202 | self.$element.find('#left_field_panel').append(QWeb.render('ExportTreeView-Secondary', {'fields': result})); | 202 | self.$el.find('#left_field_panel').append(QWeb.render('ExportTreeView-Secondary', {'fields': result})); |
1189 | 203 | } | 203 | } |
1190 | 204 | _.each(result, function(record) { | 204 | _.each(result, function(record) { |
1191 | 205 | self.records[record.id] = record.value; | 205 | self.records[record.id] = record.value; |
1192 | 206 | if (record.required) { | 206 | if (record.required) { |
1194 | 207 | var required_fld = self.$element.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); | 207 | var required_fld = self.$el.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); |
1195 | 208 | required_fld.addClass("oe_export_requiredfield"); | 208 | required_fld.addClass("oe_export_requiredfield"); |
1196 | 209 | } | 209 | } |
1198 | 210 | self.$element.find("img[id='parentimg-" + record.id +"']").click(function() { | 210 | self.$el.find("img[id='parentimg-" + record.id +"']").click(function() { |
1199 | 211 | self.on_click(this.id, record); | 211 | self.on_click(this.id, record); |
1200 | 212 | }); | 212 | }); |
1201 | 213 | 213 | ||
1203 | 214 | self.$element.find("tr[id='treerow-" + record.id + "']").click(function(e) { | 214 | self.$el.find("tr[id='treerow-" + record.id + "']").click(function(e) { |
1204 | 215 | if (e.shiftKey) { | 215 | if (e.shiftKey) { |
1205 | 216 | var frst_click, scnd_click = ''; | 216 | var frst_click, scnd_click = ''; |
1206 | 217 | if (self.row_index == 0) { | 217 | if (self.row_index == 0) { |
1207 | 218 | self.row_index = this.rowIndex; | 218 | self.row_index = this.rowIndex; |
1209 | 219 | frst_click = self.$element.find("tr[id^='treerow-']")[self.row_index-1]; | 219 | frst_click = self.$el.find("tr[id^='treerow-']")[self.row_index-1]; |
1210 | 220 | $(frst_click).addClass("ui-selected"); | 220 | $(frst_click).addClass("ui-selected"); |
1211 | 221 | } else { | 221 | } else { |
1212 | 222 | if (this.rowIndex >=self.row_index) { | 222 | if (this.rowIndex >=self.row_index) { |
1213 | 223 | for (var i = (self.row_index-1); i < this.rowIndex; i++) { | 223 | for (var i = (self.row_index-1); i < this.rowIndex; i++) { |
1215 | 224 | scnd_click = self.$element.find("tr[id^='treerow-']")[i]; | 224 | scnd_click = self.$el.find("tr[id^='treerow-']")[i]; |
1216 | 225 | if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) { | 225 | if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1217 | 226 | $(scnd_click).addClass("ui-selected"); | 226 | $(scnd_click).addClass("ui-selected"); |
1218 | 227 | } | 227 | } |
1219 | 228 | } | 228 | } |
1220 | 229 | } else { | 229 | } else { |
1221 | 230 | for (var i = (self.row_index-1); i >= (this.rowIndex-1); i--) { | 230 | for (var i = (self.row_index-1); i >= (this.rowIndex-1); i--) { |
1223 | 231 | scnd_click = self.$element.find("tr[id^='treerow-']")[i]; | 231 | scnd_click = self.$el.find("tr[id^='treerow-']")[i]; |
1224 | 232 | if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) { | 232 | if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1225 | 233 | $(scnd_click).addClass("ui-selected"); | 233 | $(scnd_click).addClass("ui-selected"); |
1226 | 234 | } | 234 | } |
1227 | @@ -238,10 +238,10 @@ | |||
1228 | 238 | } | 238 | } |
1229 | 239 | self.row_index = this.rowIndex; | 239 | self.row_index = this.rowIndex; |
1230 | 240 | 240 | ||
1232 | 241 | self.$element.find("tr[id='treerow-" + record.id + "']").keyup(function() { | 241 | self.$el.find("tr[id='treerow-" + record.id + "']").keyup(function() { |
1233 | 242 | self.row_index = 0; | 242 | self.row_index = 0; |
1234 | 243 | }); | 243 | }); |
1236 | 244 | var o2m_selection = self.$element.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); | 244 | var o2m_selection = self.$el.find("tr[id='treerow-" + record.id + "']").find('#tree-column'); |
1237 | 245 | if ($(o2m_selection).hasClass("oe_export_readonlyfield")) { | 245 | if ($(o2m_selection).hasClass("oe_export_readonlyfield")) { |
1238 | 246 | return false; | 246 | return false; |
1239 | 247 | } | 247 | } |
1240 | @@ -252,14 +252,14 @@ | |||
1241 | 252 | $(this).addClass('ui-selected').find('a').focus(); | 252 | $(this).addClass('ui-selected').find('a').focus(); |
1242 | 253 | } | 253 | } |
1243 | 254 | } else if (!e.shiftKey) { | 254 | } else if (!e.shiftKey) { |
1245 | 255 | self.$element.find("tr.ui-selected") | 255 | self.$el.find("tr.ui-selected") |
1246 | 256 | .removeClass("ui-selected").find('a').blur(); | 256 | .removeClass("ui-selected").find('a').blur(); |
1247 | 257 | $(this).addClass("ui-selected").find('a').focus(); | 257 | $(this).addClass("ui-selected").find('a').focus(); |
1248 | 258 | } | 258 | } |
1249 | 259 | return false; | 259 | return false; |
1250 | 260 | }); | 260 | }); |
1251 | 261 | 261 | ||
1253 | 262 | self.$element.find("tr[id='treerow-" + record.id + "']").keydown(function(e) { | 262 | self.$el.find("tr[id='treerow-" + record.id + "']").keydown(function(e) { |
1254 | 263 | var keyCode = e.keyCode || e.which; | 263 | var keyCode = e.keyCode || e.which; |
1255 | 264 | var arrow = {left: 37, up: 38, right: 39, down: 40 }; | 264 | var arrow = {left: 37, up: 38, right: 39, down: 40 }; |
1256 | 265 | switch (keyCode) { | 265 | switch (keyCode) { |
1257 | @@ -297,19 +297,19 @@ | |||
1258 | 297 | break; | 297 | break; |
1259 | 298 | } | 298 | } |
1260 | 299 | }); | 299 | }); |
1263 | 300 | self.$element.find("tr[id='treerow-" + record.id + "']").dblclick(function() { | 300 | self.$el.find("tr[id='treerow-" + record.id + "']").dblclick(function() { |
1264 | 301 | var $o2m_selection = self.$element.find("tr[id^='treerow-" + record.id + "']").find('#tree-column'); | 301 | var $o2m_selection = self.$el.find("tr[id^='treerow-" + record.id + "']").find('#tree-column'); |
1265 | 302 | if (!$o2m_selection.hasClass("oe_export_readonlyfield")) { | 302 | if (!$o2m_selection.hasClass("oe_export_readonlyfield")) { |
1266 | 303 | self.add_field(record.id, $(this).find("a").attr("string")); | 303 | self.add_field(record.id, $(this).find("a").attr("string")); |
1267 | 304 | } | 304 | } |
1268 | 305 | }); | 305 | }); |
1269 | 306 | }); | 306 | }); |
1271 | 307 | self.$element.find('#fields_list').mouseover(function(event) { | 307 | self.$el.find('#fields_list').mouseover(function(event) { |
1272 | 308 | if (event.relatedTarget) { | 308 | if (event.relatedTarget) { |
1273 | 309 | if (event.relatedTarget.attributes['id'] && event.relatedTarget.attributes['string']) { | 309 | if (event.relatedTarget.attributes['id'] && event.relatedTarget.attributes['string']) { |
1274 | 310 | var field_id = event.relatedTarget.attributes["id"]["value"]; | 310 | var field_id = event.relatedTarget.attributes["id"]["value"]; |
1275 | 311 | if (field_id && field_id.split("-")[0] === 'export') { | 311 | if (field_id && field_id.split("-")[0] === 'export') { |
1277 | 312 | if (!self.$element.find("tr[id='treerow-" + field_id.split("-")[1] + "']").find('#tree-column').hasClass("oe_export_readonlyfield")) { | 312 | if (!self.$el.find("tr[id='treerow-" + field_id.split("-")[1] + "']").find('#tree-column').hasClass("oe_export_readonlyfield")) { |
1278 | 313 | self.add_field(field_id.split("-")[1], event.relatedTarget.attributes["string"]["value"]); | 313 | self.add_field(field_id.split("-")[1], event.relatedTarget.attributes["string"]["value"]); |
1279 | 314 | } | 314 | } |
1280 | 315 | } | 315 | } |
1281 | @@ -319,7 +319,7 @@ | |||
1282 | 319 | }, | 319 | }, |
1283 | 320 | showcontent: function(id) { | 320 | showcontent: function(id) { |
1284 | 321 | // show & hide the contents | 321 | // show & hide the contents |
1286 | 322 | var $this = this.$element.find("tr[id='treerow-" + id + "']"); | 322 | var $this = this.$el.find("tr[id='treerow-" + id + "']"); |
1287 | 323 | var is_open = $this.hasClass('open'); | 323 | var is_open = $this.hasClass('open'); |
1288 | 324 | $this.toggleClass('open'); | 324 | $this.toggleClass('open'); |
1289 | 325 | 325 | ||
1290 | @@ -329,7 +329,7 @@ | |||
1291 | 329 | } else { | 329 | } else { |
1292 | 330 | first_child.attr('src', '/web/static/src/img/collapse.gif'); | 330 | first_child.attr('src', '/web/static/src/img/collapse.gif'); |
1293 | 331 | } | 331 | } |
1295 | 332 | var child_field = this.$element.find("tr[id^='treerow-" + id +"/']"); | 332 | var child_field = this.$el.find("tr[id^='treerow-" + id +"/']"); |
1296 | 333 | var child_len = (id.split("/")).length + 1; | 333 | var child_len = (id.split("/")).length + 1; |
1297 | 334 | for (var i = 0; i < child_field.length; i++) { | 334 | for (var i = 0; i < child_field.length; i++) { |
1298 | 335 | var $child = $(child_field[i]); | 335 | var $child = $(child_field[i]); |
1299 | @@ -345,15 +345,15 @@ | |||
1300 | 345 | } | 345 | } |
1301 | 346 | }, | 346 | }, |
1302 | 347 | add_field: function(field_id, string) { | 347 | add_field: function(field_id, string) { |
1306 | 348 | var field_list = this.$element.find('#fields_list'); | 348 | var field_list = this.$el.find('#fields_list'); |
1307 | 349 | if (this.$element.find("#fields_list option[value='" + field_id + "']") | 349 | if (this.$el.find("#fields_list option[value='" + field_id + "']") |
1308 | 350 | && !this.$element.find("#fields_list option[value='" + field_id + "']").length) { | 350 | && !this.$el.find("#fields_list option[value='" + field_id + "']").length) { |
1309 | 351 | field_list.append(new Option(string, field_id)); | 351 | field_list.append(new Option(string, field_id)); |
1310 | 352 | } | 352 | } |
1311 | 353 | }, | 353 | }, |
1312 | 354 | get_fields: function() { | 354 | get_fields: function() { |
1313 | 355 | var export_field = []; | 355 | var export_field = []; |
1315 | 356 | this.$element.find("#fields_list option").each(function() { | 356 | this.$el.find("#fields_list option").each(function() { |
1316 | 357 | export_field.push($(this).val()); | 357 | export_field.push($(this).val()); |
1317 | 358 | }); | 358 | }); |
1318 | 359 | if (!export_field.length) { | 359 | if (!export_field.length) { |
1319 | @@ -363,7 +363,7 @@ | |||
1320 | 363 | }, | 363 | }, |
1321 | 364 | on_click_export_data: function() { | 364 | on_click_export_data: function() { |
1322 | 365 | var self = this; | 365 | var self = this; |
1324 | 366 | var exported_fields = this.$element.find('#fields_list option').map(function () { | 366 | var exported_fields = this.$el.find('#fields_list option').map(function () { |
1325 | 367 | // DOM property is textContent, but IE8 only knows innerText | 367 | // DOM property is textContent, but IE8 only knows innerText |
1326 | 368 | return {name: self.records[this.value] || this.value, | 368 | return {name: self.records[this.value] || this.value, |
1327 | 369 | label: this.textContent || this.innerText}; | 369 | label: this.textContent || this.innerText}; |
1328 | @@ -375,7 +375,7 @@ | |||
1329 | 375 | } | 375 | } |
1330 | 376 | 376 | ||
1331 | 377 | exported_fields.unshift({name: 'id', label: 'External ID'}); | 377 | exported_fields.unshift({name: 'id', label: 'External ID'}); |
1333 | 378 | var export_format = this.$element.find("#export_format").val(); | 378 | var export_format = this.$el.find("#export_format").val(); |
1334 | 379 | instance.web.blockUI(); | 379 | instance.web.blockUI(); |
1335 | 380 | this.session.get_file({ | 380 | this.session.get_file({ |
1336 | 381 | url: '/web/export/' + export_format, | 381 | url: '/web/export/' + export_format, |
1337 | @@ -385,13 +385,13 @@ | |||
1338 | 385 | ids: this.dataset.ids, | 385 | ids: this.dataset.ids, |
1339 | 386 | domain: this.dataset.domain, | 386 | domain: this.dataset.domain, |
1340 | 387 | import_compat: Boolean( | 387 | import_compat: Boolean( |
1342 | 388 | this.$element.find("#import_compat").val()) | 388 | this.$el.find("#import_compat").val()) |
1343 | 389 | })}, | 389 | })}, |
1344 | 390 | complete: instance.web.unblockUI | 390 | complete: instance.web.unblockUI |
1345 | 391 | }); | 391 | }); |
1346 | 392 | }, | 392 | }, |
1347 | 393 | close: function() { | 393 | close: function() { |
1349 | 394 | this.$element.remove(); | 394 | this.$el.remove(); |
1350 | 395 | this._super(); | 395 | this._super(); |
1351 | 396 | } | 396 | } |
1352 | 397 | }); | 397 | }); |
1353 | 398 | 398 | ||
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 | 75 | } | 75 | } |
1359 | 76 | }); | 76 | }); |
1360 | 77 | this.toggle_import_button(false); | 77 | this.toggle_import_button(false); |
1364 | 78 | this.$element.find('#csvfile').change(this.on_autodetect_data); | 78 | this.$el.find('#csvfile').change(this.on_autodetect_data); |
1365 | 79 | this.$element.find('fieldset').change(this.on_autodetect_data); | 79 | this.$el.find('fieldset').change(this.on_autodetect_data); |
1366 | 80 | this.$element.delegate('fieldset legend', 'click', function() { | 80 | this.$el.delegate('fieldset legend', 'click', function() { |
1367 | 81 | $(this).parent().toggleClass('oe_closed'); | 81 | $(this).parent().toggleClass('oe_closed'); |
1368 | 82 | }); | 82 | }); |
1369 | 83 | this.ready.push(new instance.web.DataSet(this, this.model).call( | 83 | this.ready.push(new instance.web.DataSet(this, this.model).call( |
1370 | @@ -156,19 +156,19 @@ | |||
1371 | 156 | }); | 156 | }); |
1372 | 157 | }, | 157 | }, |
1373 | 158 | toggle_import_button: function (newstate) { | 158 | toggle_import_button: function (newstate) { |
1375 | 159 | instance.web.dialog(this.$element, 'widget') | 159 | instance.web.dialog(this.$el, 'widget') |
1376 | 160 | .find('.oe_import_dialog_button') | 160 | .find('.oe_import_dialog_button') |
1377 | 161 | .button('option', 'disabled', !newstate); | 161 | .button('option', 'disabled', !newstate); |
1378 | 162 | }, | 162 | }, |
1379 | 163 | do_import: function() { | 163 | do_import: function() { |
1383 | 164 | if(!this.$element.find('#csvfile').val()) { return; } | 164 | if(!this.$el.find('#csvfile').val()) { return; } |
1384 | 165 | var lines_to_skip = parseInt(this.$element.find('#csv_skip').val(), 10); | 165 | var lines_to_skip = parseInt(this.$el.find('#csv_skip').val(), 10); |
1385 | 166 | var with_headers = this.$element.find('#file_has_headers').prop('checked'); | 166 | var with_headers = this.$el.find('#file_has_headers').prop('checked'); |
1386 | 167 | if (!lines_to_skip && with_headers) { | 167 | if (!lines_to_skip && with_headers) { |
1387 | 168 | lines_to_skip = 1; | 168 | lines_to_skip = 1; |
1388 | 169 | } | 169 | } |
1389 | 170 | var indices = [], fields = []; | 170 | var indices = [], fields = []; |
1391 | 171 | this.$element.find(".sel_fields").each(function(index, element) { | 171 | this.$el.find(".sel_fields").each(function(index, element) { |
1392 | 172 | var val = element.value; | 172 | var val = element.value; |
1393 | 173 | if (!val) { | 173 | if (!val) { |
1394 | 174 | return; | 174 | return; |
1395 | @@ -177,7 +177,7 @@ | |||
1396 | 177 | fields.push(val); | 177 | fields.push(val); |
1397 | 178 | }); | 178 | }); |
1398 | 179 | 179 | ||
1400 | 180 | jsonp(this.$element.find('#import_data'), { | 180 | jsonp(this.$el.find('#import_data'), { |
1401 | 181 | url: '/web/import/import_data', | 181 | url: '/web/import/import_data', |
1402 | 182 | data: { | 182 | data: { |
1403 | 183 | model: this.model, | 183 | model: this.model, |
1404 | @@ -190,19 +190,19 @@ | |||
1405 | 190 | }, this.on_import_results); | 190 | }, this.on_import_results); |
1406 | 191 | }, | 191 | }, |
1407 | 192 | on_autodetect_data: function() { | 192 | on_autodetect_data: function() { |
1410 | 193 | if(!this.$element.find('#csvfile').val()) { return; } | 193 | if(!this.$el.find('#csvfile').val()) { return; } |
1411 | 194 | jsonp(this.$element.find('#import_data'), { | 194 | jsonp(this.$el.find('#import_data'), { |
1412 | 195 | url: '/web/import/detect_data' | 195 | url: '/web/import/detect_data' |
1413 | 196 | }, this.on_import_results); | 196 | }, this.on_import_results); |
1414 | 197 | }, | 197 | }, |
1415 | 198 | on_import_results: function(results) { | 198 | on_import_results: function(results) { |
1418 | 199 | this.$element.find('#result').empty(); | 199 | this.$el.find('#result').empty(); |
1419 | 200 | var headers, result_node = this.$element.find("#result"); | 200 | var headers, result_node = this.$el.find("#result"); |
1420 | 201 | 201 | ||
1421 | 202 | if (results['error']) { | 202 | if (results['error']) { |
1422 | 203 | result_node.append(QWeb.render('ImportView.error', { | 203 | result_node.append(QWeb.render('ImportView.error', { |
1423 | 204 | 'error': results['error']})); | 204 | 'error': results['error']})); |
1425 | 205 | this.$element.find('fieldset').removeClass('oe_closed'); | 205 | this.$el.find('fieldset').removeClass('oe_closed'); |
1426 | 206 | return; | 206 | return; |
1427 | 207 | } | 207 | } |
1428 | 208 | if (results['success']) { | 208 | if (results['success']) { |
1429 | @@ -214,8 +214,8 @@ | |||
1430 | 214 | } | 214 | } |
1431 | 215 | 215 | ||
1432 | 216 | if (results['records']) { | 216 | if (results['records']) { |
1435 | 217 | var lines_to_skip = parseInt(this.$element.find('#csv_skip').val(), 10), | 217 | var lines_to_skip = parseInt(this.$el.find('#csv_skip').val(), 10), |
1436 | 218 | with_headers = this.$element.find('#file_has_headers').prop('checked'); | 218 | with_headers = this.$el.find('#file_has_headers').prop('checked'); |
1437 | 219 | headers = with_headers ? results.records[0] : null; | 219 | headers = with_headers ? results.records[0] : null; |
1438 | 220 | 220 | ||
1439 | 221 | result_node.append(QWeb.render('ImportView.result', { | 221 | result_node.append(QWeb.render('ImportView.result', { |
1440 | @@ -224,17 +224,17 @@ | |||
1441 | 224 | : with_headers ? results.records.slice(1) | 224 | : with_headers ? results.records.slice(1) |
1442 | 225 | : results.records | 225 | : results.records |
1443 | 226 | })); | 226 | })); |
1445 | 227 | this.$element.find('fieldset').addClass('oe_closed'); | 227 | this.$el.find('fieldset').addClass('oe_closed'); |
1446 | 228 | } | 228 | } |
1448 | 229 | this.$element.find('form').removeClass('oe_import_no_result'); | 229 | this.$el.find('form').removeClass('oe_import_no_result'); |
1449 | 230 | 230 | ||
1451 | 231 | this.$element.delegate('.oe_m2o_drop_down_button', 'click', function () { | 231 | this.$el.delegate('.oe_m2o_drop_down_button', 'click', function () { |
1452 | 232 | $(this).prev('input').focus(); | 232 | $(this).prev('input').focus(); |
1453 | 233 | }); | 233 | }); |
1454 | 234 | 234 | ||
1455 | 235 | var self = this; | 235 | var self = this; |
1456 | 236 | this.ready.then(function () { | 236 | this.ready.then(function () { |
1458 | 237 | var $fields = self.$element.find('.sel_fields').bind('blur', function () { | 237 | var $fields = self.$el.find('.sel_fields').bind('blur', function () { |
1459 | 238 | if (this.value && !_(self.all_fields).contains(this.value)) { | 238 | if (this.value && !_(self.all_fields).contains(this.value)) { |
1460 | 239 | this.value = ''; | 239 | this.value = ''; |
1461 | 240 | } | 240 | } |
1462 | @@ -315,9 +315,9 @@ | |||
1463 | 315 | find_duplicate_fields: function() { | 315 | find_duplicate_fields: function() { |
1464 | 316 | // Maps values to DOM nodes, in order to discover duplicates | 316 | // Maps values to DOM nodes, in order to discover duplicates |
1465 | 317 | var values = {}, duplicates = {}; | 317 | var values = {}, duplicates = {}; |
1467 | 318 | this.$element.find(".sel_fields").each(function(index, element) { | 318 | this.$el.find(".sel_fields").each(function(index, element) { |
1468 | 319 | var value = element.value; | 319 | var value = element.value; |
1470 | 320 | var $element = $(element).removeClass('duplicate_fld'); | 320 | var $el = $(element).removeClass('duplicate_fld'); |
1471 | 321 | if (!value) { return; } | 321 | if (!value) { return; } |
1472 | 322 | 322 | ||
1473 | 323 | if (!(value in values)) { | 323 | if (!(value in values)) { |
1474 | @@ -329,13 +329,13 @@ | |||
1475 | 329 | } else { | 329 | } else { |
1476 | 330 | duplicates[value] = [same_valued_field, element]; | 330 | duplicates[value] = [same_valued_field, element]; |
1477 | 331 | } | 331 | } |
1479 | 332 | $element.add(same_valued_field).addClass('duplicate_fld'); | 332 | $el.add(same_valued_field).addClass('duplicate_fld'); |
1480 | 333 | } | 333 | } |
1481 | 334 | }); | 334 | }); |
1482 | 335 | return duplicates; | 335 | return duplicates; |
1483 | 336 | }, | 336 | }, |
1484 | 337 | on_check_field_values: function () { | 337 | on_check_field_values: function () { |
1486 | 338 | this.$element.find("#message, #msg").remove(); | 338 | this.$el.find("#message, #msg").remove(); |
1487 | 339 | 339 | ||
1488 | 340 | var required_valid = this.check_required(); | 340 | var required_valid = this.check_required(); |
1489 | 341 | 341 | ||
1490 | @@ -343,7 +343,7 @@ | |||
1491 | 343 | if (_.isEmpty(duplicates)) { | 343 | if (_.isEmpty(duplicates)) { |
1492 | 344 | this.toggle_import_button(required_valid); | 344 | this.toggle_import_button(required_valid); |
1493 | 345 | } else { | 345 | } else { |
1495 | 346 | 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')); | 346 | 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 | 347 | var $dupes = $('<dl>').appendTo($err); | 347 | var $dupes = $('<dl>').appendTo($err); |
1497 | 348 | _(duplicates).each(function(elements, value) { | 348 | _(duplicates).each(function(elements, value) { |
1498 | 349 | $('<dt>').text(value).appendTo($dupes); | 349 | $('<dt>').text(value).appendTo($dupes); |
1499 | @@ -372,7 +372,7 @@ | |||
1500 | 372 | return f.id; | 372 | return f.id; |
1501 | 373 | }; | 373 | }; |
1502 | 374 | 374 | ||
1504 | 375 | var selected_fields = _(this.$element.find('.sel_fields').get()).chain() | 375 | var selected_fields = _(this.$el.find('.sel_fields').get()).chain() |
1505 | 376 | .pluck('value') | 376 | .pluck('value') |
1506 | 377 | .compact() | 377 | .compact() |
1507 | 378 | .map(resolve_field_id) | 378 | .map(resolve_field_id) |
1508 | @@ -380,13 +380,13 @@ | |||
1509 | 380 | 380 | ||
1510 | 381 | var missing_fields = _.difference(this.required_fields, selected_fields); | 381 | var missing_fields = _.difference(this.required_fields, selected_fields); |
1511 | 382 | if (missing_fields.length) { | 382 | if (missing_fields.length) { |
1513 | 383 | this.$element.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>'); | 383 | this.$el.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>'); |
1514 | 384 | return false; | 384 | return false; |
1515 | 385 | } | 385 | } |
1516 | 386 | return true; | 386 | return true; |
1517 | 387 | }, | 387 | }, |
1518 | 388 | destroy: function() { | 388 | destroy: function() { |
1520 | 389 | this.$element.remove(); | 389 | this.$el.remove(); |
1521 | 390 | this._super(); | 390 | this._super(); |
1522 | 391 | } | 391 | } |
1523 | 392 | }); | 392 | }); |
1524 | 393 | 393 | ||
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 | 126 | template: 'SearchView.InputView', | 126 | template: 'SearchView.InputView', |
1530 | 127 | start: function () { | 127 | start: function () { |
1531 | 128 | var p = this._super.apply(this, arguments); | 128 | var p = this._super.apply(this, arguments); |
1535 | 129 | this.$element.on('focus', this.proxy('onFocus')); | 129 | this.$el.on('focus', this.proxy('onFocus')); |
1536 | 130 | this.$element.on('blur', this.proxy('onBlur')); | 130 | this.$el.on('blur', this.proxy('onBlur')); |
1537 | 131 | this.$element.on('keydown', this.proxy('onKeydown')); | 131 | this.$el.on('keydown', this.proxy('onKeydown')); |
1538 | 132 | return p; | 132 | return p; |
1539 | 133 | }, | 133 | }, |
1540 | 134 | onFocus: function () { | 134 | onFocus: function () { |
1541 | 135 | this.trigger('focused', this); | 135 | this.trigger('focused', this); |
1542 | 136 | }, | 136 | }, |
1543 | 137 | onBlur: function () { | 137 | onBlur: function () { |
1545 | 138 | this.$element.text(''); | 138 | this.$el.text(''); |
1546 | 139 | this.trigger('blurred', this); | 139 | this.trigger('blurred', this); |
1547 | 140 | }, | 140 | }, |
1548 | 141 | getSelection: function () { | 141 | getSelection: function () { |
1549 | 142 | // get Text node | 142 | // get Text node |
1551 | 143 | var root = this.$element[0].childNodes[0]; | 143 | var root = this.$el[0].childNodes[0]; |
1552 | 144 | if (!root || !root.textContent) { | 144 | if (!root || !root.textContent) { |
1553 | 145 | // if input does not have a child node, or the child node is an | 145 | // if input does not have a child node, or the child node is an |
1554 | 146 | // empty string, then the selection can only be (0, 0) | 146 | // empty string, then the selection can only be (0, 0) |
1555 | @@ -202,7 +202,7 @@ | |||
1556 | 202 | break; | 202 | break; |
1557 | 203 | case $.ui.keyCode.RIGHT: | 203 | case $.ui.keyCode.RIGHT: |
1558 | 204 | sel = this.getSelection(); | 204 | sel = this.getSelection(); |
1560 | 205 | var len = this.$element.text().length; | 205 | var len = this.$el.text().length; |
1561 | 206 | if (sel.start !== len || sel.start !== sel.end) { | 206 | if (sel.start !== len || sel.start !== sel.end) { |
1562 | 207 | e.stopPropagation(); | 207 | e.stopPropagation(); |
1563 | 208 | } | 208 | } |
1564 | @@ -223,17 +223,17 @@ | |||
1565 | 223 | }, | 223 | }, |
1566 | 224 | start: function () { | 224 | start: function () { |
1567 | 225 | var self = this; | 225 | var self = this; |
1571 | 226 | this.$element.on('focus', function () { self.trigger('focused', self); }); | 226 | this.$el.on('focus', function () { self.trigger('focused', self); }); |
1572 | 227 | this.$element.on('blur', function () { self.trigger('blurred', self); }); | 227 | this.$el.on('blur', function () { self.trigger('blurred', self); }); |
1573 | 228 | this.$element.on('click', function (e) { | 228 | this.$el.on('click', function (e) { |
1574 | 229 | if ($(e.target).is('.oe_facet_remove')) { | 229 | if ($(e.target).is('.oe_facet_remove')) { |
1575 | 230 | self.model.destroy(); | 230 | self.model.destroy(); |
1576 | 231 | return false; | 231 | return false; |
1577 | 232 | } | 232 | } |
1579 | 233 | self.$element.focus(); | 233 | self.$el.focus(); |
1580 | 234 | e.stopPropagation(); | 234 | e.stopPropagation(); |
1581 | 235 | }); | 235 | }); |
1583 | 236 | this.$element.on('keydown', function (e) { | 236 | this.$el.on('keydown', function (e) { |
1584 | 237 | var keys = $.ui.keyCode; | 237 | var keys = $.ui.keyCode; |
1585 | 238 | switch (e.which) { | 238 | switch (e.which) { |
1586 | 239 | case keys.BACKSPACE: | 239 | case keys.BACKSPACE: |
1587 | @@ -242,7 +242,7 @@ | |||
1588 | 242 | return false; | 242 | return false; |
1589 | 243 | } | 243 | } |
1590 | 244 | }); | 244 | }); |
1592 | 245 | var $e = self.$element.find('> span:last-child'); | 245 | var $e = self.$el.find('> span:last-child'); |
1593 | 246 | var q = $.when(this._super()); | 246 | var q = $.when(this._super()); |
1594 | 247 | return q.pipe(function () { | 247 | return q.pipe(function () { |
1595 | 248 | var values = self.model.values.map(function (value) { | 248 | var values = self.model.values.map(function (value) { |
1596 | @@ -253,7 +253,7 @@ | |||
1597 | 253 | }); | 253 | }); |
1598 | 254 | }, | 254 | }, |
1599 | 255 | model_changed: function () { | 255 | model_changed: function () { |
1601 | 256 | this.$element.text(this.$element.text() + '*'); | 256 | this.$el.text(this.$el.text() + '*'); |
1602 | 257 | } | 257 | } |
1603 | 258 | }); | 258 | }); |
1604 | 259 | my.FacetValueView = instance.web.Widget.extend({ | 259 | my.FacetValueView = instance.web.Widget.extend({ |
1605 | @@ -268,7 +268,7 @@ | |||
1606 | 268 | this._super(); | 268 | this._super(); |
1607 | 269 | }, | 269 | }, |
1608 | 270 | model_changed: function () { | 270 | model_changed: function () { |
1610 | 271 | this.$element.text(this.$element.text() + '*'); | 271 | this.$el.text(this.$el.text() + '*'); |
1611 | 272 | } | 272 | } |
1612 | 273 | }); | 273 | }); |
1613 | 274 | 274 | ||
1614 | @@ -313,7 +313,7 @@ | |||
1615 | 313 | .on('add change reset remove', this.proxy('renderFacets')); | 313 | .on('add change reset remove', this.proxy('renderFacets')); |
1616 | 314 | 314 | ||
1617 | 315 | if (this.hidden) { | 315 | if (this.hidden) { |
1619 | 316 | this.$element.hide(); | 316 | this.$el.hide(); |
1620 | 317 | } | 317 | } |
1621 | 318 | if (this.headless) { | 318 | if (this.headless) { |
1622 | 319 | this.ready.resolve(); | 319 | this.ready.resolve(); |
1623 | @@ -331,12 +331,12 @@ | |||
1624 | 331 | } | 331 | } |
1625 | 332 | 332 | ||
1626 | 333 | // Launch a search on clicking the oe_searchview_search button | 333 | // Launch a search on clicking the oe_searchview_search button |
1628 | 334 | this.$element.on('click', 'button.oe_searchview_search', function (e) { | 334 | this.$el.on('click', 'button.oe_searchview_search', function (e) { |
1629 | 335 | e.stopImmediatePropagation(); | 335 | e.stopImmediatePropagation(); |
1630 | 336 | self.do_search(); | 336 | self.do_search(); |
1631 | 337 | }); | 337 | }); |
1632 | 338 | 338 | ||
1634 | 339 | this.$element.on('keydown', | 339 | this.$el.on('keydown', |
1635 | 340 | '.oe_searchview_input, .oe_searchview_facet', function (e) { | 340 | '.oe_searchview_input, .oe_searchview_facet', function (e) { |
1636 | 341 | switch(e.which) { | 341 | switch(e.which) { |
1637 | 342 | case $.ui.keyCode.LEFT: | 342 | case $.ui.keyCode.LEFT: |
1638 | @@ -350,31 +350,31 @@ | |||
1639 | 350 | } | 350 | } |
1640 | 351 | }); | 351 | }); |
1641 | 352 | 352 | ||
1643 | 353 | this.$element.on('click', '.oe_searchview_clear', function (e) { | 353 | this.$el.on('click', '.oe_searchview_clear', function (e) { |
1644 | 354 | e.stopImmediatePropagation(); | 354 | e.stopImmediatePropagation(); |
1645 | 355 | self.query.reset(); | 355 | self.query.reset(); |
1646 | 356 | }); | 356 | }); |
1648 | 357 | this.$element.on('click', '.oe_searchview_unfold_drawer', function (e) { | 357 | this.$el.on('click', '.oe_searchview_unfold_drawer', function (e) { |
1649 | 358 | e.stopImmediatePropagation(); | 358 | e.stopImmediatePropagation(); |
1651 | 359 | self.$element.toggleClass('oe_searchview_open_drawer'); | 359 | self.$el.toggleClass('oe_searchview_open_drawer'); |
1652 | 360 | }); | 360 | }); |
1653 | 361 | instance.web.bus.on('click', this, function(ev) { | 361 | instance.web.bus.on('click', this, function(ev) { |
1654 | 362 | if ($(ev.target).parents('.oe_searchview').length === 0) { | 362 | if ($(ev.target).parents('.oe_searchview').length === 0) { |
1656 | 363 | self.$element.removeClass('oe_searchview_open_drawer'); | 363 | self.$el.removeClass('oe_searchview_open_drawer'); |
1657 | 364 | } | 364 | } |
1658 | 365 | }); | 365 | }); |
1659 | 366 | // Focus last input if the view itself is clicked (empty section of | 366 | // Focus last input if the view itself is clicked (empty section of |
1660 | 367 | // facets element) | 367 | // facets element) |
1664 | 368 | this.$element.on('click', function (e) { | 368 | this.$el.on('click', function (e) { |
1665 | 369 | if (e.target === self.$element.find('.oe_searchview_facets')[0]) { | 369 | if (e.target === self.$el.find('.oe_searchview_facets')[0]) { |
1666 | 370 | self.$element.find('.oe_searchview_input:last').focus(); | 370 | self.$el.find('.oe_searchview_input:last').focus(); |
1667 | 371 | } | 371 | } |
1668 | 372 | }); | 372 | }); |
1669 | 373 | // when the completion list opens/refreshes, automatically select the | 373 | // when the completion list opens/refreshes, automatically select the |
1670 | 374 | // first completion item so if the user just hits [RETURN] or [TAB] it | 374 | // first completion item so if the user just hits [RETURN] or [TAB] it |
1671 | 375 | // automatically selects it | 375 | // automatically selects it |
1674 | 376 | this.$element.on('autocompleteopen', function () { | 376 | this.$el.on('autocompleteopen', function () { |
1675 | 377 | var menu = self.$element.data('autocomplete').menu; | 377 | var menu = self.$el.data('autocomplete').menu; |
1676 | 378 | menu.activate( | 378 | menu.activate( |
1677 | 379 | $.Event({ type: "mouseenter" }), | 379 | $.Event({ type: "mouseenter" }), |
1678 | 380 | menu.element.children().first()); | 380 | menu.element.children().first()); |
1679 | @@ -383,15 +383,15 @@ | |||
1680 | 383 | return $.when(p, this.ready); | 383 | return $.when(p, this.ready); |
1681 | 384 | }, | 384 | }, |
1682 | 385 | show: function () { | 385 | show: function () { |
1684 | 386 | this.$element.show(); | 386 | this.$el.show(); |
1685 | 387 | }, | 387 | }, |
1686 | 388 | hide: function () { | 388 | hide: function () { |
1688 | 389 | this.$element.hide(); | 389 | this.$el.hide(); |
1689 | 390 | }, | 390 | }, |
1690 | 391 | 391 | ||
1691 | 392 | subviewForRoot: function (subview_root) { | 392 | subviewForRoot: function (subview_root) { |
1692 | 393 | return _(this.input_subviews).detect(function (subview) { | 393 | return _(this.input_subviews).detect(function (subview) { |
1694 | 394 | return subview.$element[0] === subview_root; | 394 | return subview.$el[0] === subview_root; |
1695 | 395 | }); | 395 | }); |
1696 | 396 | }, | 396 | }, |
1697 | 397 | siblingSubview: function (subview, direction, wrap_around) { | 397 | siblingSubview: function (subview, direction, wrap_around) { |
1698 | @@ -406,12 +406,12 @@ | |||
1699 | 406 | focusPreceding: function (subview_root) { | 406 | focusPreceding: function (subview_root) { |
1700 | 407 | return this.siblingSubview( | 407 | return this.siblingSubview( |
1701 | 408 | this.subviewForRoot(subview_root), -1, true) | 408 | this.subviewForRoot(subview_root), -1, true) |
1703 | 409 | .$element.focus(); | 409 | .$el.focus(); |
1704 | 410 | }, | 410 | }, |
1705 | 411 | focusFollowing: function (subview_root) { | 411 | focusFollowing: function (subview_root) { |
1706 | 412 | return this.siblingSubview( | 412 | return this.siblingSubview( |
1707 | 413 | this.subviewForRoot(subview_root), +1, true) | 413 | this.subviewForRoot(subview_root), +1, true) |
1709 | 414 | .$element.focus(); | 414 | .$el.focus(); |
1710 | 415 | }, | 415 | }, |
1711 | 416 | 416 | ||
1712 | 417 | /** | 417 | /** |
1713 | @@ -430,19 +430,19 @@ | |||
1714 | 430 | 430 | ||
1715 | 431 | // autocomplete only correctly handles being initialized on the actual | 431 | // autocomplete only correctly handles being initialized on the actual |
1716 | 432 | // editable element (and only an element with a @value in 1.8 e.g. | 432 | // editable element (and only an element with a @value in 1.8 e.g. |
1719 | 433 | // input or textarea), cheat by setting val() on $element | 433 | // input or textarea), cheat by setting val() on $el |
1720 | 434 | this.$element.on('keydown', function () { | 434 | this.$el.on('keydown', function () { |
1721 | 435 | // keydown is triggered *before* the element's value is set, so | 435 | // keydown is triggered *before* the element's value is set, so |
1722 | 436 | // delay this. Pray that setTimeout are executed in FIFO (if they | 436 | // delay this. Pray that setTimeout are executed in FIFO (if they |
1723 | 437 | // have the same delay) as autocomplete uses the exact same trick. | 437 | // have the same delay) as autocomplete uses the exact same trick. |
1724 | 438 | // FIXME: brittle as fuck | 438 | // FIXME: brittle as fuck |
1725 | 439 | setTimeout(function () { | 439 | setTimeout(function () { |
1727 | 440 | self.$element.val(self.currentInputValue()); | 440 | self.$el.val(self.currentInputValue()); |
1728 | 441 | }, 0); | 441 | }, 0); |
1729 | 442 | 442 | ||
1730 | 443 | }); | 443 | }); |
1731 | 444 | 444 | ||
1733 | 445 | this.$element.autocomplete({ | 445 | this.$el.autocomplete({ |
1734 | 446 | source: this.proxy('complete_global_search'), | 446 | source: this.proxy('complete_global_search'), |
1735 | 447 | select: this.proxy('select_completion'), | 447 | select: this.proxy('select_completion'), |
1736 | 448 | focus: function (e) { e.preventDefault(); }, | 448 | focus: function (e) { e.preventDefault(); }, |
1737 | @@ -479,7 +479,7 @@ | |||
1738 | 479 | * div[contenteditable].oe_searchview_input) | 479 | * div[contenteditable].oe_searchview_input) |
1739 | 480 | */ | 480 | */ |
1740 | 481 | currentInputValue: function () { | 481 | currentInputValue: function () { |
1742 | 482 | return this.$element.find('div.oe_searchview_input:focus').text(); | 482 | return this.$el.find('div.oe_searchview_input:focus').text(); |
1743 | 483 | }, | 483 | }, |
1744 | 484 | /** | 484 | /** |
1745 | 485 | * Provide auto-completion result for req.term (an array to `resp`) | 485 | * Provide auto-completion result for req.term (an array to `resp`) |
1746 | @@ -509,22 +509,22 @@ | |||
1747 | 509 | 509 | ||
1748 | 510 | var input_index = _(this.input_subviews).indexOf( | 510 | var input_index = _(this.input_subviews).indexOf( |
1749 | 511 | this.subviewForRoot( | 511 | this.subviewForRoot( |
1751 | 512 | this.$element.find('div.oe_searchview_input:focus')[0])); | 512 | this.$el.find('div.oe_searchview_input:focus')[0])); |
1752 | 513 | this.query.add(ui.item.facet, {at: input_index / 2}); | 513 | this.query.add(ui.item.facet, {at: input_index / 2}); |
1753 | 514 | }, | 514 | }, |
1754 | 515 | childFocused: function () { | 515 | childFocused: function () { |
1756 | 516 | this.$element.addClass('oe_focused'); | 516 | this.$el.addClass('oe_focused'); |
1757 | 517 | }, | 517 | }, |
1758 | 518 | childBlurred: function () { | 518 | childBlurred: function () { |
1762 | 519 | var val = this.$element.val(); | 519 | var val = this.$el.val(); |
1763 | 520 | this.$element.val(''); | 520 | this.$el.val(''); |
1764 | 521 | var complete = this.$element.data('autocomplete'); | 521 | var complete = this.$el.data('autocomplete'); |
1765 | 522 | if ((val && complete.term === undefined) || complete.previous !== undefined) { | 522 | if ((val && complete.term === undefined) || complete.previous !== undefined) { |
1766 | 523 | throw new Error("new jquery.ui version altering implementation" + | 523 | throw new Error("new jquery.ui version altering implementation" + |
1767 | 524 | " details relied on"); | 524 | " details relied on"); |
1768 | 525 | } | 525 | } |
1769 | 526 | delete complete.term; | 526 | delete complete.term; |
1771 | 527 | this.$element.removeClass('oe_focused') | 527 | this.$el.removeClass('oe_focused') |
1772 | 528 | .trigger('blur'); | 528 | .trigger('blur'); |
1773 | 529 | }, | 529 | }, |
1774 | 530 | /** | 530 | /** |
1775 | @@ -538,7 +538,7 @@ | |||
1776 | 538 | // _2: undefined if event=change, otherwise model | 538 | // _2: undefined if event=change, otherwise model |
1777 | 539 | var self = this; | 539 | var self = this; |
1778 | 540 | var started = []; | 540 | var started = []; |
1780 | 541 | var $e = this.$element.find('div.oe_searchview_facets'); | 541 | var $e = this.$el.find('div.oe_searchview_facets'); |
1781 | 542 | _.invoke(this.input_subviews, 'destroy'); | 542 | _.invoke(this.input_subviews, 'destroy'); |
1782 | 543 | this.input_subviews = []; | 543 | this.input_subviews = []; |
1783 | 544 | 544 | ||
1784 | @@ -569,7 +569,7 @@ | |||
1785 | 569 | input_to_focus = self.input_subviews[(options.at + 1) * 2]; | 569 | input_to_focus = self.input_subviews[(options.at + 1) * 2]; |
1786 | 570 | } | 570 | } |
1787 | 571 | 571 | ||
1789 | 572 | input_to_focus.$element.focus(); | 572 | input_to_focus.$el.focus(); |
1790 | 573 | }); | 573 | }); |
1791 | 574 | }, | 574 | }, |
1792 | 575 | 575 | ||
1793 | @@ -664,7 +664,7 @@ | |||
1794 | 664 | // build drawer | 664 | // build drawer |
1795 | 665 | var drawer_started = $.when.apply( | 665 | var drawer_started = $.when.apply( |
1796 | 666 | null, _(this.select_for_drawer()).invoke( | 666 | null, _(this.select_for_drawer()).invoke( |
1798 | 667 | 'appendTo', this.$element.find('.oe_searchview_drawer'))); | 667 | 'appendTo', this.$el.find('.oe_searchview_drawer'))); |
1799 | 668 | 668 | ||
1800 | 669 | // load defaults | 669 | // load defaults |
1801 | 670 | var defaults_fetched = $.when.apply(null, _(this.inputs).invoke( | 670 | var defaults_fetched = $.when.apply(null, _(this.inputs).invoke( |
1802 | @@ -680,7 +680,7 @@ | |||
1803 | 680 | */ | 680 | */ |
1804 | 681 | on_filters_management: function(e) { | 681 | on_filters_management: function(e) { |
1805 | 682 | var self = this; | 682 | var self = this; |
1807 | 683 | var select = this.$element.find(".oe_search-view-filters-management"); | 683 | var select = this.$el.find(".oe_search-view-filters-management"); |
1808 | 684 | var val = select.val(); | 684 | var val = select.val(); |
1809 | 685 | switch(val) { | 685 | switch(val) { |
1810 | 686 | case 'advanced_filter': | 686 | case 'advanced_filter': |
1811 | @@ -989,7 +989,7 @@ | |||
1812 | 989 | this.view.query.on('add remove change reset', this.proxy('search_change')); | 989 | this.view.query.on('add remove change reset', this.proxy('search_change')); |
1813 | 990 | }, | 990 | }, |
1814 | 991 | start: function () { | 991 | start: function () { |
1816 | 992 | this.$element.on('click', 'li', this.proxy('toggle_filter')); | 992 | this.$el.on('click', 'li', this.proxy('toggle_filter')); |
1817 | 993 | return $.when(null); | 993 | return $.when(null); |
1818 | 994 | }, | 994 | }, |
1819 | 995 | /** | 995 | /** |
1820 | @@ -998,7 +998,7 @@ | |||
1821 | 998 | */ | 998 | */ |
1822 | 999 | search_change: function () { | 999 | search_change: function () { |
1823 | 1000 | var self = this; | 1000 | var self = this; |
1825 | 1001 | var $filters = this.$element.find('> li').removeClass('oe_selected'); | 1001 | var $filters = this.$el.find('> li').removeClass('oe_selected'); |
1826 | 1002 | var facet = this.view.query.find(_.bind(this.match_facet, this)); | 1002 | var facet = this.view.query.find(_.bind(this.match_facet, this)); |
1827 | 1003 | if (!facet) { return; } | 1003 | if (!facet) { return; } |
1828 | 1004 | facet.values.each(function (v) { | 1004 | facet.values.each(function (v) { |
1829 | @@ -1299,17 +1299,17 @@ | |||
1830 | 1299 | }); | 1299 | }); |
1831 | 1300 | instance.web.search.NumberField = instance.web.search.Field.extend(/** @lends instance.web.search.NumberField# */{ | 1300 | instance.web.search.NumberField = instance.web.search.Field.extend(/** @lends instance.web.search.NumberField# */{ |
1832 | 1301 | value_from: function () { | 1301 | value_from: function () { |
1834 | 1302 | if (!this.$element.val()) { | 1302 | if (!this.$el.val()) { |
1835 | 1303 | return null; | 1303 | return null; |
1836 | 1304 | } | 1304 | } |
1839 | 1305 | var val = this.parse(this.$element.val()), | 1305 | var val = this.parse(this.$el.val()), |
1840 | 1306 | check = Number(this.$element.val()); | 1306 | check = Number(this.$el.val()); |
1841 | 1307 | if (isNaN(val) || val !== check) { | 1307 | if (isNaN(val) || val !== check) { |
1843 | 1308 | this.$element.addClass('error'); | 1308 | this.$el.addClass('error'); |
1844 | 1309 | throw new instance.web.search.Invalid( | 1309 | throw new instance.web.search.Invalid( |
1846 | 1310 | this.attrs.name, this.$element.val(), this.error_message); | 1310 | this.attrs.name, this.$el.val(), this.error_message); |
1847 | 1311 | } | 1311 | } |
1849 | 1312 | this.$element.removeClass('error'); | 1312 | this.$el.removeClass('error'); |
1850 | 1313 | return val; | 1313 | return val; |
1851 | 1314 | } | 1314 | } |
1852 | 1315 | }); | 1315 | }); |
1853 | @@ -1542,9 +1542,9 @@ | |||
1854 | 1542 | self.clear_selection(); | 1542 | self.clear_selection(); |
1855 | 1543 | }) | 1543 | }) |
1856 | 1544 | .on('reset', this.proxy('clear_selection')); | 1544 | .on('reset', this.proxy('clear_selection')); |
1860 | 1545 | this.$element.on('submit', 'form', this.proxy('save_current')); | 1545 | this.$el.on('submit', 'form', this.proxy('save_current')); |
1861 | 1546 | this.$element.on('click', 'h4', function () { | 1546 | this.$el.on('click', 'h4', function () { |
1862 | 1547 | self.$element.toggleClass('oe_opened'); | 1547 | self.$el.toggleClass('oe_opened'); |
1863 | 1548 | }); | 1548 | }); |
1864 | 1549 | // FIXME: local eval of domain and context to get rid of special endpoint | 1549 | // FIXME: local eval of domain and context to get rid of special endpoint |
1865 | 1550 | return this.rpc('/web/searchview/get_filters', { | 1550 | return this.rpc('/web/searchview/get_filters', { |
1866 | @@ -1552,7 +1552,7 @@ | |||
1867 | 1552 | }).pipe(this.proxy('set_filters')); | 1552 | }).pipe(this.proxy('set_filters')); |
1868 | 1553 | }, | 1553 | }, |
1869 | 1554 | clear_selection: function () { | 1554 | clear_selection: function () { |
1871 | 1555 | this.$element.find('li.oe_selected').removeClass('oe_selected'); | 1555 | this.$el.find('li.oe_selected').removeClass('oe_selected'); |
1872 | 1556 | }, | 1556 | }, |
1873 | 1557 | append_filter: function (filter) { | 1557 | append_filter: function (filter) { |
1874 | 1558 | var self = this; | 1558 | var self = this; |
1875 | @@ -1564,7 +1564,7 @@ | |||
1876 | 1564 | } else { | 1564 | } else { |
1877 | 1565 | var id = filter.id; | 1565 | var id = filter.id; |
1878 | 1566 | $filter = this.filters[key] = $('<li></li>') | 1566 | $filter = this.filters[key] = $('<li></li>') |
1880 | 1567 | .appendTo(this.$element.find('.oe_searchview_custom_list')) | 1567 | .appendTo(this.$el.find('.oe_searchview_custom_list')) |
1881 | 1568 | .addClass(filter.user_id ? 'oe_searchview_custom_private' | 1568 | .addClass(filter.user_id ? 'oe_searchview_custom_private' |
1882 | 1569 | : 'oe_searchview_custom_public') | 1569 | : 'oe_searchview_custom_public') |
1883 | 1570 | .text(filter.name); | 1570 | .text(filter.name); |
1884 | @@ -1599,8 +1599,8 @@ | |||
1885 | 1599 | }, | 1599 | }, |
1886 | 1600 | save_current: function () { | 1600 | save_current: function () { |
1887 | 1601 | var self = this; | 1601 | var self = this; |
1890 | 1602 | var $name = this.$element.find('input:first'); | 1602 | var $name = this.$el.find('input:first'); |
1891 | 1603 | var private_filter = !this.$element.find('input:last').prop('checked'); | 1603 | var private_filter = !this.$el.find('input:last').prop('checked'); |
1892 | 1604 | 1604 | ||
1893 | 1605 | var search = this.view.build_search_data(); | 1605 | var search = this.view.build_search_data(); |
1894 | 1606 | this.rpc('/web/session/eval_domain_and_context', { | 1606 | this.rpc('/web/session/eval_domain_and_context', { |
1895 | @@ -1622,7 +1622,7 @@ | |||
1896 | 1622 | return self.model.call('create_or_replace', [filter]).then(function (id) { | 1622 | return self.model.call('create_or_replace', [filter]).then(function (id) { |
1897 | 1623 | filter.id = id; | 1623 | filter.id = id; |
1898 | 1624 | self.append_filter(filter); | 1624 | self.append_filter(filter); |
1900 | 1625 | self.$element | 1625 | self.$el |
1901 | 1626 | .removeClass('oe_opened') | 1626 | .removeClass('oe_opened') |
1902 | 1627 | .find('form')[0].reset(); | 1627 | .find('form')[0].reset(); |
1903 | 1628 | }); | 1628 | }); |
1904 | @@ -1667,8 +1667,8 @@ | |||
1905 | 1667 | } | 1667 | } |
1906 | 1668 | 1668 | ||
1907 | 1669 | return $.when( | 1669 | return $.when( |
1910 | 1670 | this.render_column(col1, $('<div>').appendTo(this.$element)), | 1670 | this.render_column(col1, $('<div>').appendTo(this.$el)), |
1911 | 1671 | this.render_column(col2, $('<div>').appendTo(this.$element))); | 1671 | this.render_column(col2, $('<div>').appendTo(this.$el))); |
1912 | 1672 | }, | 1672 | }, |
1913 | 1673 | render_column: function (column, $el) { | 1673 | render_column: function (column, $el) { |
1914 | 1674 | return $.when.apply(null, _(column).map(function (group) { | 1674 | return $.when.apply(null, _(column).map(function (group) { |
1915 | @@ -1684,10 +1684,10 @@ | |||
1916 | 1684 | _in_drawer: true, | 1684 | _in_drawer: true, |
1917 | 1685 | start: function () { | 1685 | start: function () { |
1918 | 1686 | var self = this; | 1686 | var self = this; |
1920 | 1687 | this.$element | 1687 | this.$el |
1921 | 1688 | .on('keypress keydown keyup', function (e) { e.stopPropagation(); }) | 1688 | .on('keypress keydown keyup', function (e) { e.stopPropagation(); }) |
1922 | 1689 | .on('click', 'h4', function () { | 1689 | .on('click', 'h4', function () { |
1924 | 1690 | self.$element.toggleClass('oe_opened'); | 1690 | self.$el.toggleClass('oe_opened'); |
1925 | 1691 | }).on('click', 'button.oe_add_condition', function () { | 1691 | }).on('click', 'button.oe_add_condition', function () { |
1926 | 1692 | self.append_proposition(); | 1692 | self.append_proposition(); |
1927 | 1693 | }).on('submit', 'form', function (e) { | 1693 | }).on('submit', 'form', function (e) { |
1928 | @@ -1706,7 +1706,7 @@ | |||
1929 | 1706 | }, | 1706 | }, |
1930 | 1707 | append_proposition: function () { | 1707 | append_proposition: function () { |
1931 | 1708 | return (new instance.web.search.ExtendedSearchProposition(this, this.fields)) | 1708 | return (new instance.web.search.ExtendedSearchProposition(this, this.fields)) |
1933 | 1709 | .appendTo(this.$element.find('ul')); | 1709 | .appendTo(this.$el.find('ul')); |
1934 | 1710 | }, | 1710 | }, |
1935 | 1711 | commit_search: function () { | 1711 | commit_search: function () { |
1936 | 1712 | var self = this; | 1712 | var self = this; |
1937 | @@ -1733,7 +1733,7 @@ | |||
1938 | 1733 | // add new empty proposition | 1733 | // add new empty proposition |
1939 | 1734 | this.append_proposition(); | 1734 | this.append_proposition(); |
1940 | 1735 | // TODO: API on searchview | 1735 | // TODO: API on searchview |
1942 | 1736 | this.view.$element.removeClass('oe_searchview_open_drawer'); | 1736 | this.view.$el.removeClass('oe_searchview_open_drawer'); |
1943 | 1737 | } | 1737 | } |
1944 | 1738 | }); | 1738 | }); |
1945 | 1739 | 1739 | ||
1946 | @@ -1757,16 +1757,16 @@ | |||
1947 | 1757 | }, | 1757 | }, |
1948 | 1758 | start: function () { | 1758 | start: function () { |
1949 | 1759 | var _this = this; | 1759 | var _this = this; |
1951 | 1760 | this.$element.find(".searchview_extended_prop_field").change(function() { | 1760 | this.$el.find(".searchview_extended_prop_field").change(function() { |
1952 | 1761 | _this.changed(); | 1761 | _this.changed(); |
1953 | 1762 | }); | 1762 | }); |
1955 | 1763 | this.$element.find('.searchview_extended_delete_prop').click(function () { | 1763 | this.$el.find('.searchview_extended_delete_prop').click(function () { |
1956 | 1764 | _this.destroy(); | 1764 | _this.destroy(); |
1957 | 1765 | }); | 1765 | }); |
1958 | 1766 | this.changed(); | 1766 | this.changed(); |
1959 | 1767 | }, | 1767 | }, |
1960 | 1768 | changed: function() { | 1768 | changed: function() { |
1962 | 1769 | var nval = this.$element.find(".searchview_extended_prop_field").val(); | 1769 | var nval = this.$el.find(".searchview_extended_prop_field").val(); |
1963 | 1770 | if(this.attrs.selected == null || nval != this.attrs.selected.name) { | 1770 | if(this.attrs.selected == null || nval != this.attrs.selected.name) { |
1964 | 1771 | this.select_field(_.detect(this.fields, function(x) {return x.name == nval;})); | 1771 | this.select_field(_.detect(this.fields, function(x) {return x.name == nval;})); |
1965 | 1772 | } | 1772 | } |
1966 | @@ -1781,7 +1781,7 @@ | |||
1967 | 1781 | if(this.attrs.selected != null) { | 1781 | if(this.attrs.selected != null) { |
1968 | 1782 | this.value.destroy(); | 1782 | this.value.destroy(); |
1969 | 1783 | this.value = null; | 1783 | this.value = null; |
1971 | 1784 | this.$element.find('.searchview_extended_prop_op').html(''); | 1784 | this.$el.find('.searchview_extended_prop_op').html(''); |
1972 | 1785 | } | 1785 | } |
1973 | 1786 | this.attrs.selected = field; | 1786 | this.attrs.selected = field; |
1974 | 1787 | if(field == null) { | 1787 | if(field == null) { |
1975 | @@ -1797,9 +1797,9 @@ | |||
1976 | 1797 | _.each(this.value.operators, function(operator) { | 1797 | _.each(this.value.operators, function(operator) { |
1977 | 1798 | $('<option>', {value: operator.value}) | 1798 | $('<option>', {value: operator.value}) |
1978 | 1799 | .text(String(operator.text)) | 1799 | .text(String(operator.text)) |
1980 | 1800 | .appendTo(self.$element.find('.searchview_extended_prop_op')); | 1800 | .appendTo(self.$el.find('.searchview_extended_prop_op')); |
1981 | 1801 | }); | 1801 | }); |
1983 | 1802 | var $value_loc = this.$element.find('.searchview_extended_prop_value').empty(); | 1802 | var $value_loc = this.$el.find('.searchview_extended_prop_value').empty(); |
1984 | 1803 | this.value.appendTo($value_loc); | 1803 | this.value.appendTo($value_loc); |
1985 | 1804 | 1804 | ||
1986 | 1805 | }, | 1805 | }, |
1987 | @@ -1807,7 +1807,7 @@ | |||
1988 | 1807 | if ( this.attrs.selected == null) | 1807 | if ( this.attrs.selected == null) |
1989 | 1808 | return null; | 1808 | return null; |
1990 | 1809 | var field = this.attrs.selected; | 1809 | var field = this.attrs.selected; |
1992 | 1810 | var op = this.$element.find('.searchview_extended_prop_op')[0]; | 1810 | var op = this.$el.find('.searchview_extended_prop_op')[0]; |
1993 | 1811 | var operator = op.options[op.selectedIndex]; | 1811 | var operator = op.options[op.selectedIndex]; |
1994 | 1812 | return { | 1812 | return { |
1995 | 1813 | label: _.str.sprintf(_t('%(field)s %(operator)s "%(value)s"'), { | 1813 | label: _.str.sprintf(_t('%(field)s %(operator)s "%(value)s"'), { |
1996 | @@ -1851,7 +1851,7 @@ | |||
1997 | 1851 | {value: "!=", text: _lt("is not equal to")} | 1851 | {value: "!=", text: _lt("is not equal to")} |
1998 | 1852 | ], | 1852 | ], |
1999 | 1853 | get_value: function() { | 1853 | get_value: function() { |
2001 | 1854 | return this.$element.val(); | 1854 | return this.$el.val(); |
2002 | 1855 | } | 1855 | } |
2003 | 1856 | }); | 1856 | }); |
2004 | 1857 | instance.web.search.ExtendedSearchProposition.DateTime = instance.web.search.ExtendedSearchProposition.Field.extend({ | 1857 | instance.web.search.ExtendedSearchProposition.DateTime = instance.web.search.ExtendedSearchProposition.Field.extend({ |
2005 | @@ -1875,7 +1875,7 @@ | |||
2006 | 1875 | start: function() { | 1875 | start: function() { |
2007 | 1876 | var ready = this._super(); | 1876 | var ready = this._super(); |
2008 | 1877 | this.datewidget = new (this.widget())(this); | 1877 | this.datewidget = new (this.widget())(this); |
2010 | 1878 | this.datewidget.appendTo(this.$element); | 1878 | this.datewidget.appendTo(this.$el); |
2011 | 1879 | return ready; | 1879 | return ready; |
2012 | 1880 | } | 1880 | } |
2013 | 1881 | }); | 1881 | }); |
2014 | @@ -1893,11 +1893,11 @@ | |||
2015 | 1893 | {value: "<=", text: _lt("less or equal than")} | 1893 | {value: "<=", text: _lt("less or equal than")} |
2016 | 1894 | ], | 1894 | ], |
2017 | 1895 | toString: function () { | 1895 | toString: function () { |
2019 | 1896 | return this.$element.val(); | 1896 | return this.$el.val(); |
2020 | 1897 | }, | 1897 | }, |
2021 | 1898 | get_value: function() { | 1898 | get_value: function() { |
2022 | 1899 | try { | 1899 | try { |
2024 | 1900 | return instance.web.parse_value(this.$element.val(), {'widget': 'integer'}); | 1900 | return instance.web.parse_value(this.$el.val(), {'widget': 'integer'}); |
2025 | 1901 | } catch (e) { | 1901 | } catch (e) { |
2026 | 1902 | return ""; | 1902 | return ""; |
2027 | 1903 | } | 1903 | } |
2028 | @@ -1917,11 +1917,11 @@ | |||
2029 | 1917 | {value: "<=", text: _lt("less or equal than")} | 1917 | {value: "<=", text: _lt("less or equal than")} |
2030 | 1918 | ], | 1918 | ], |
2031 | 1919 | toString: function () { | 1919 | toString: function () { |
2033 | 1920 | return this.$element.val(); | 1920 | return this.$el.val(); |
2034 | 1921 | }, | 1921 | }, |
2035 | 1922 | get_value: function() { | 1922 | get_value: function() { |
2036 | 1923 | try { | 1923 | try { |
2038 | 1924 | return instance.web.parse_value(this.$element.val(), {'widget': 'float'}); | 1924 | return instance.web.parse_value(this.$el.val(), {'widget': 'float'}); |
2039 | 1925 | } catch (e) { | 1925 | } catch (e) { |
2040 | 1926 | return ""; | 1926 | return ""; |
2041 | 1927 | } | 1927 | } |
2042 | @@ -1934,12 +1934,12 @@ | |||
2043 | 1934 | {value: "!=", text: _lt("is not")} | 1934 | {value: "!=", text: _lt("is not")} |
2044 | 1935 | ], | 1935 | ], |
2045 | 1936 | toString: function () { | 1936 | toString: function () { |
2047 | 1937 | var select = this.$element[0]; | 1937 | var select = this.$el[0]; |
2048 | 1938 | var option = select.options[select.selectedIndex]; | 1938 | var option = select.options[select.selectedIndex]; |
2049 | 1939 | return option.label || option.text; | 1939 | return option.label || option.text; |
2050 | 1940 | }, | 1940 | }, |
2051 | 1941 | get_value: function() { | 1941 | get_value: function() { |
2053 | 1942 | return this.$element.val(); | 1942 | return this.$el.val(); |
2054 | 1943 | } | 1943 | } |
2055 | 1944 | }); | 1944 | }); |
2056 | 1945 | instance.web.search.ExtendedSearchProposition.Boolean = instance.web.search.ExtendedSearchProposition.Field.extend({ | 1945 | instance.web.search.ExtendedSearchProposition.Boolean = instance.web.search.ExtendedSearchProposition.Field.extend({ |
2057 | 1946 | 1946 | ||
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 | 102 | w.off('focused blurred'); | 102 | w.off('focused blurred'); |
2063 | 103 | w.destroy(); | 103 | w.destroy(); |
2064 | 104 | }); | 104 | }); |
2067 | 105 | if (this.$element) { | 105 | if (this.$el) { |
2068 | 106 | this.$element.off('.formBlur'); | 106 | this.$el.off('.formBlur'); |
2069 | 107 | } | 107 | } |
2070 | 108 | this._super(); | 108 | this._super(); |
2071 | 109 | }, | 109 | }, |
2072 | @@ -122,11 +122,11 @@ | |||
2073 | 122 | this.rendering_engine.set_tags_registry(this.tags_registry); | 122 | this.rendering_engine.set_tags_registry(this.tags_registry); |
2074 | 123 | if (!this.extract_qweb_template(data)) { | 123 | if (!this.extract_qweb_template(data)) { |
2075 | 124 | this.rendering_engine.set_fields_view(data); | 124 | this.rendering_engine.set_fields_view(data); |
2077 | 125 | var $dest = this.$element.hasClass("oe_form_container") ? this.$element : this.$element.find('.oe_form_container'); | 125 | var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); |
2078 | 126 | this.rendering_engine.render_to($dest); | 126 | this.rendering_engine.render_to($dest); |
2079 | 127 | } | 127 | } |
2080 | 128 | 128 | ||
2082 | 129 | this.$element.on('mousedown.formBlur', function () { | 129 | this.$el.on('mousedown.formBlur', function () { |
2083 | 130 | self.__clicked_inside = true; | 130 | self.__clicked_inside = true; |
2084 | 131 | }); | 131 | }); |
2085 | 132 | 132 | ||
2086 | @@ -134,14 +134,14 @@ | |||
2087 | 134 | if (this.options.$buttons) { | 134 | if (this.options.$buttons) { |
2088 | 135 | this.$buttons.appendTo(this.options.$buttons); | 135 | this.$buttons.appendTo(this.options.$buttons); |
2089 | 136 | } else { | 136 | } else { |
2091 | 137 | this.$element.find('.oe_form_buttons').replaceWith(this.$buttons); | 137 | this.$el.find('.oe_form_buttons').replaceWith(this.$buttons); |
2092 | 138 | } | 138 | } |
2093 | 139 | this.$buttons.on('click','.oe_form_button_create',this.on_button_create); | 139 | this.$buttons.on('click','.oe_form_button_create',this.on_button_create); |
2094 | 140 | this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit); | 140 | this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit); |
2095 | 141 | this.$buttons.on('click','.oe_form_button_save',this.on_button_save); | 141 | this.$buttons.on('click','.oe_form_button_save',this.on_button_save); |
2096 | 142 | this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel); | 142 | this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel); |
2097 | 143 | 143 | ||
2099 | 144 | this.$sidebar = this.options.$sidebar || this.$element.find('.oe_form_sidebar'); | 144 | this.$sidebar = this.options.$sidebar || this.$el.find('.oe_form_sidebar'); |
2100 | 145 | if (!this.sidebar && this.options.$sidebar) { | 145 | if (!this.sidebar && this.options.$sidebar) { |
2101 | 146 | this.sidebar = new instance.web.Sidebar(this); | 146 | this.sidebar = new instance.web.Sidebar(this); |
2102 | 147 | this.sidebar.appendTo(this.$sidebar); | 147 | this.sidebar.appendTo(this.$sidebar); |
2103 | @@ -158,7 +158,7 @@ | |||
2104 | 158 | this.has_been_loaded.resolve(); | 158 | this.has_been_loaded.resolve(); |
2105 | 159 | 159 | ||
2106 | 160 | // Add bounce effect on button 'Edit' when click on readonly page view. | 160 | // Add bounce effect on button 'Edit' when click on readonly page view. |
2108 | 161 | this.$element.find(".oe_form_field,label").on('click', function (e) { | 161 | this.$el.find(".oe_form_field,label").on('click', function (e) { |
2109 | 162 | if(self.get("actual_mode") == "view") { | 162 | if(self.get("actual_mode") == "view") { |
2110 | 163 | var $button = self.options.$buttons.find(".oe_form_button_edit"); | 163 | var $button = self.options.$buttons.find(".oe_form_button_edit"); |
2111 | 164 | $button.effect('bounce', {distance: 18, times: 5}, 150) | 164 | $button.effect('bounce', {distance: 18, times: 5}, 150) |
2112 | @@ -215,7 +215,7 @@ | |||
2113 | 215 | this.default_focus_field = null; | 215 | this.default_focus_field = null; |
2114 | 216 | this.default_focus_button = null; | 216 | this.default_focus_button = null; |
2115 | 217 | this.translatable_fields = []; | 217 | this.translatable_fields = []; |
2117 | 218 | this.$element.find('.oe_form_container').empty(); | 218 | this.$el.find('.oe_form_container').empty(); |
2118 | 219 | }, | 219 | }, |
2119 | 220 | 220 | ||
2120 | 221 | widgetFocused: function() { | 221 | widgetFocused: function() { |
2121 | @@ -263,7 +263,7 @@ | |||
2122 | 263 | var self = this; | 263 | var self = this; |
2123 | 264 | options = options || {}; | 264 | options = options || {}; |
2124 | 265 | if (this.sidebar) { | 265 | if (this.sidebar) { |
2126 | 266 | this.sidebar.$element.show(); | 266 | this.sidebar.$el.show(); |
2127 | 267 | } | 267 | } |
2128 | 268 | if (this.$buttons) { | 268 | if (this.$buttons) { |
2129 | 269 | this.$buttons.show(); | 269 | this.$buttons.show(); |
2130 | @@ -271,11 +271,11 @@ | |||
2131 | 271 | if (this.$pager) { | 271 | if (this.$pager) { |
2132 | 272 | this.$pager.show(); | 272 | this.$pager.show(); |
2133 | 273 | } | 273 | } |
2135 | 274 | this.$element.show().css({ | 274 | this.$el.show().css({ |
2136 | 275 | opacity: '0', | 275 | opacity: '0', |
2137 | 276 | filter: 'alpha(opacity = 0)' | 276 | filter: 'alpha(opacity = 0)' |
2138 | 277 | }); | 277 | }); |
2140 | 278 | this.$element.add(this.$buttons).removeClass('oe_form_dirty'); | 278 | this.$el.add(this.$buttons).removeClass('oe_form_dirty'); |
2141 | 279 | 279 | ||
2142 | 280 | var shown = this.has_been_loaded; | 280 | var shown = this.has_been_loaded; |
2143 | 281 | if (options.reload !== false) { | 281 | if (options.reload !== false) { |
2144 | @@ -293,7 +293,7 @@ | |||
2145 | 293 | } | 293 | } |
2146 | 294 | return shown.pipe(function() { | 294 | return shown.pipe(function() { |
2147 | 295 | self._actualize_mode(options.mode || self.options.initial_mode); | 295 | self._actualize_mode(options.mode || self.options.initial_mode); |
2149 | 296 | self.$element.css({ | 296 | self.$el.css({ |
2150 | 297 | opacity: '1', | 297 | opacity: '1', |
2151 | 298 | filter: 'alpha(opacity = 100)' | 298 | filter: 'alpha(opacity = 100)' |
2152 | 299 | }); | 299 | }); |
2153 | @@ -301,7 +301,7 @@ | |||
2154 | 301 | }, | 301 | }, |
2155 | 302 | do_hide: function () { | 302 | do_hide: function () { |
2156 | 303 | if (this.sidebar) { | 303 | if (this.sidebar) { |
2158 | 304 | this.sidebar.$element.hide(); | 304 | this.sidebar.$el.hide(); |
2159 | 305 | } | 305 | } |
2160 | 306 | if (this.$buttons) { | 306 | if (this.$buttons) { |
2161 | 307 | this.$buttons.hide(); | 307 | this.$buttons.hide(); |
2162 | @@ -325,7 +325,7 @@ | |||
2163 | 325 | if (this.qweb) { | 325 | if (this.qweb) { |
2164 | 326 | this.kill_current_form(); | 326 | this.kill_current_form(); |
2165 | 327 | this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record)); | 327 | this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record)); |
2167 | 328 | var $dest = this.$element.hasClass("oe_form_container") ? this.$element : this.$element.find('.oe_form_container'); | 328 | var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); |
2168 | 329 | this.rendering_engine.render_to($dest); | 329 | this.rendering_engine.render_to($dest); |
2169 | 330 | } | 330 | } |
2170 | 331 | 331 | ||
2171 | @@ -357,7 +357,7 @@ | |||
2172 | 357 | } else { | 357 | } else { |
2173 | 358 | self.do_push_state({}); | 358 | self.do_push_state({}); |
2174 | 359 | } | 359 | } |
2176 | 360 | self.$element.add(self.$buttons).removeClass('oe_form_dirty'); | 360 | self.$el.add(self.$buttons).removeClass('oe_form_dirty'); |
2177 | 361 | self.autofocus(); | 361 | self.autofocus(); |
2178 | 362 | }); | 362 | }); |
2179 | 363 | }, | 363 | }, |
2180 | @@ -379,7 +379,7 @@ | |||
2181 | 379 | this.trigger("view_content_has_changed"); | 379 | this.trigger("view_content_has_changed"); |
2182 | 380 | }, | 380 | }, |
2183 | 381 | do_notify_change: function() { | 381 | do_notify_change: function() { |
2185 | 382 | this.$element.add(this.$buttons).addClass('oe_form_dirty'); | 382 | this.$el.add(this.$buttons).addClass('oe_form_dirty'); |
2186 | 383 | }, | 383 | }, |
2187 | 384 | on_pager_action: function(action) { | 384 | on_pager_action: function(action) { |
2188 | 385 | if (this.can_be_discarded()) { | 385 | if (this.can_be_discarded()) { |
2189 | @@ -410,7 +410,7 @@ | |||
2190 | 410 | if (this.options.$pager) { | 410 | if (this.options.$pager) { |
2191 | 411 | this.$pager.appendTo(this.options.$pager); | 411 | this.$pager.appendTo(this.options.$pager); |
2192 | 412 | } else { | 412 | } else { |
2194 | 413 | this.$element.find('.oe_form_pager').replaceWith(this.$pager); | 413 | this.$el.find('.oe_form_pager').replaceWith(this.$pager); |
2195 | 414 | } | 414 | } |
2196 | 415 | this.$pager.on('click','a[data-pager-action]',function() { | 415 | this.$pager.on('click','a[data-pager-action]',function() { |
2197 | 416 | var action = $(this).data('pager-action'); | 416 | var action = $(this).data('pager-action'); |
2198 | @@ -653,7 +653,7 @@ | |||
2199 | 653 | check_actual_mode: function(source, options) { | 653 | check_actual_mode: function(source, options) { |
2200 | 654 | var self = this; | 654 | var self = this; |
2201 | 655 | if(this.get("actual_mode") === "view") { | 655 | if(this.get("actual_mode") === "view") { |
2203 | 656 | self.$element.removeClass('oe_form_editable').addClass('oe_form_readonly'); | 656 | self.$el.removeClass('oe_form_editable').addClass('oe_form_readonly'); |
2204 | 657 | self.$buttons.find('.oe_form_buttons_edit').hide(); | 657 | self.$buttons.find('.oe_form_buttons_edit').hide(); |
2205 | 658 | self.$buttons.find('.oe_form_buttons_view').show(); | 658 | self.$buttons.find('.oe_form_buttons_view').show(); |
2206 | 659 | self.$sidebar.show(); | 659 | self.$sidebar.show(); |
2207 | @@ -661,7 +661,7 @@ | |||
2208 | 661 | field.set({"force_readonly": true}); | 661 | field.set({"force_readonly": true}); |
2209 | 662 | }); | 662 | }); |
2210 | 663 | } else { | 663 | } else { |
2212 | 664 | self.$element.removeClass('oe_form_readonly').addClass('oe_form_editable'); | 664 | self.$el.removeClass('oe_form_readonly').addClass('oe_form_editable'); |
2213 | 665 | self.$buttons.find('.oe_form_buttons_edit').show(); | 665 | self.$buttons.find('.oe_form_buttons_edit').show(); |
2214 | 666 | self.$buttons.find('.oe_form_buttons_view').hide(); | 666 | self.$buttons.find('.oe_form_buttons_view').hide(); |
2215 | 667 | self.$sidebar.hide(); | 667 | self.$sidebar.hide(); |
2216 | @@ -752,7 +752,7 @@ | |||
2217 | 752 | return def.promise(); | 752 | return def.promise(); |
2218 | 753 | }, | 753 | }, |
2219 | 754 | can_be_discarded: function() { | 754 | can_be_discarded: function() { |
2221 | 755 | return !this.$element.is('.oe_form_dirty') || confirm(_t("Warning, the record has been modified, your changes will be discarded.")); | 755 | return !this.$el.is('.oe_form_dirty') || confirm(_t("Warning, the record has been modified, your changes will be discarded.")); |
2222 | 756 | }, | 756 | }, |
2223 | 757 | /** | 757 | /** |
2224 | 758 | * Triggers saving the form's record. Chooses between creating a new | 758 | * Triggers saving the form's record. Chooses between creating a new |
2225 | @@ -993,14 +993,14 @@ | |||
2226 | 993 | buttons: [ | 993 | buttons: [ |
2227 | 994 | {text: _t("Close"), click: function () { d.close(); }}, | 994 | {text: _t("Close"), click: function () { d.close(); }}, |
2228 | 995 | {text: _t("Save default"), click: function () { | 995 | {text: _t("Save default"), click: function () { |
2230 | 996 | var $defaults = d.$element.find('#formview_default_fields'); | 996 | var $defaults = d.$el.find('#formview_default_fields'); |
2231 | 997 | var field_to_set = $defaults.val(); | 997 | var field_to_set = $defaults.val(); |
2232 | 998 | if (!field_to_set) { | 998 | if (!field_to_set) { |
2233 | 999 | $defaults.parent().addClass('oe_form_invalid'); | 999 | $defaults.parent().addClass('oe_form_invalid'); |
2234 | 1000 | return; | 1000 | return; |
2235 | 1001 | } | 1001 | } |
2238 | 1002 | var condition = d.$element.find('#formview_default_conditions').val(), | 1002 | var condition = d.$el.find('#formview_default_conditions').val(), |
2239 | 1003 | all_users = d.$element.find('#formview_default_all').is(':checked'); | 1003 | all_users = d.$el.find('#formview_default_all').is(':checked'); |
2240 | 1004 | new instance.web.DataSet(self, 'ir.values').call( | 1004 | new instance.web.DataSet(self, 'ir.values').call( |
2241 | 1005 | 'set_default', [ | 1005 | 'set_default', [ |
2242 | 1006 | self.dataset.model, | 1006 | self.dataset.model, |
2243 | @@ -1054,7 +1054,7 @@ | |||
2244 | 1054 | instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({ | 1054 | instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({ |
2245 | 1055 | set_fields_view: function(fields_view) {}, | 1055 | set_fields_view: function(fields_view) {}, |
2246 | 1056 | set_fields_registry: function(fields_registry) {}, | 1056 | set_fields_registry: function(fields_registry) {}, |
2248 | 1057 | render_to: function($element) {}, | 1057 | render_to: function($el) {}, |
2249 | 1058 | }); | 1058 | }); |
2250 | 1059 | 1059 | ||
2251 | 1060 | /** | 1060 | /** |
2252 | @@ -1459,7 +1459,7 @@ | |||
2253 | 1459 | this.form = new instance.web.FormView(this, this.dataset, this.view_id, { | 1459 | this.form = new instance.web.FormView(this, this.dataset, this.view_id, { |
2254 | 1460 | pager: false | 1460 | pager: false |
2255 | 1461 | }); | 1461 | }); |
2257 | 1462 | this.form.appendTo(this.$element); | 1462 | this.form.appendTo(this.$el); |
2258 | 1463 | this.form.on_created.add_last(this.on_form_dialog_saved); | 1463 | this.form.on_created.add_last(this.on_form_dialog_saved); |
2259 | 1464 | this.form.on_saved.add_last(this.on_form_dialog_saved); | 1464 | this.form.on_saved.add_last(this.on_form_dialog_saved); |
2260 | 1465 | return this; | 1465 | return this; |
2261 | @@ -1551,7 +1551,7 @@ | |||
2262 | 1551 | /** | 1551 | /** |
2263 | 1552 | * Must be applied over an class already possessing the PropertiesMixin. | 1552 | * Must be applied over an class already possessing the PropertiesMixin. |
2264 | 1553 | * | 1553 | * |
2266 | 1554 | * Apply the result of the "invisible" domain to this.$element. | 1554 | * Apply the result of the "invisible" domain to this.$el. |
2267 | 1555 | */ | 1555 | */ |
2268 | 1556 | instance.web.form.InvisibilityChangerMixin = { | 1556 | instance.web.form.InvisibilityChangerMixin = { |
2269 | 1557 | init: function(field_manager, invisible_domain) { | 1557 | init: function(field_manager, invisible_domain) { |
2270 | @@ -1582,16 +1582,16 @@ | |||
2271 | 1582 | this._check_visibility(); | 1582 | this._check_visibility(); |
2272 | 1583 | }, | 1583 | }, |
2273 | 1584 | _check_visibility: function() { | 1584 | _check_visibility: function() { |
2275 | 1585 | this.$element.toggleClass('oe_form_invisible', this.get("effective_invisible")); | 1585 | this.$el.toggleClass('oe_form_invisible', this.get("effective_invisible")); |
2276 | 1586 | }, | 1586 | }, |
2277 | 1587 | }; | 1587 | }; |
2278 | 1588 | 1588 | ||
2279 | 1589 | instance.web.form.InvisibilityChanger = instance.web.Class.extend(instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, { | 1589 | instance.web.form.InvisibilityChanger = instance.web.Class.extend(instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, { |
2281 | 1590 | init: function(parent, field_manager, invisible_domain, $element) { | 1590 | init: function(parent, field_manager, invisible_domain, $el) { |
2282 | 1591 | this.setParent(parent); | 1591 | this.setParent(parent); |
2283 | 1592 | instance.web.PropertiesMixin.init.call(this); | 1592 | instance.web.PropertiesMixin.init.call(this); |
2284 | 1593 | instance.web.form.InvisibilityChangerMixin.init.call(this, field_manager, invisible_domain); | 1593 | instance.web.form.InvisibilityChangerMixin.init.call(this, field_manager, invisible_domain); |
2286 | 1594 | this.$element = $element; | 1594 | this.$el = $el; |
2287 | 1595 | this.start(); | 1595 | this.start(); |
2288 | 1596 | }, | 1596 | }, |
2289 | 1597 | }); | 1597 | }); |
2290 | @@ -1615,7 +1615,7 @@ | |||
2291 | 1615 | }, | 1615 | }, |
2292 | 1616 | renderElement: function() { | 1616 | renderElement: function() { |
2293 | 1617 | this._super(); | 1617 | this._super(); |
2295 | 1618 | this.$element.addClass(this.node.attrs["class"] || ""); | 1618 | this.$el.addClass(this.node.attrs["class"] || ""); |
2296 | 1619 | }, | 1619 | }, |
2297 | 1620 | destroy: function() { | 1620 | destroy: function() { |
2298 | 1621 | $.fn.tipsy.clear(); | 1621 | $.fn.tipsy.clear(); |
2299 | @@ -1649,7 +1649,7 @@ | |||
2300 | 1649 | }, | 1649 | }, |
2301 | 1650 | do_attach_tooltip: function(widget, trigger, options) { | 1650 | do_attach_tooltip: function(widget, trigger, options) { |
2302 | 1651 | widget = widget || this; | 1651 | widget = widget || this; |
2304 | 1652 | trigger = trigger || this.$element; | 1652 | trigger = trigger || this.$el; |
2305 | 1653 | options = _.extend({ | 1653 | options = _.extend({ |
2306 | 1654 | delayIn: 500, | 1654 | delayIn: 500, |
2307 | 1655 | delayOut: 0, | 1655 | delayOut: 0, |
2308 | @@ -1736,11 +1736,11 @@ | |||
2309 | 1736 | }, | 1736 | }, |
2310 | 1737 | start: function() { | 1737 | start: function() { |
2311 | 1738 | this._super.apply(this, arguments); | 1738 | this._super.apply(this, arguments); |
2313 | 1739 | this.$element.click(this.on_click); | 1739 | this.$el.click(this.on_click); |
2314 | 1740 | if (this.node.attrs.help || instance.session.debug) { | 1740 | if (this.node.attrs.help || instance.session.debug) { |
2315 | 1741 | this.do_attach_tooltip(); | 1741 | this.do_attach_tooltip(); |
2316 | 1742 | } | 1742 | } |
2318 | 1743 | this.setupFocus(this.$element); | 1743 | this.setupFocus(this.$el); |
2319 | 1744 | }, | 1744 | }, |
2320 | 1745 | on_click: function() { | 1745 | on_click: function() { |
2321 | 1746 | var self = this; | 1746 | var self = this; |
2322 | @@ -1799,8 +1799,8 @@ | |||
2323 | 1799 | }, | 1799 | }, |
2324 | 1800 | check_disable: function() { | 1800 | check_disable: function() { |
2325 | 1801 | var disabled = (this.force_disabled || !this.view.is_interactible_record()); | 1801 | var disabled = (this.force_disabled || !this.view.is_interactible_record()); |
2328 | 1802 | this.$element.prop('disabled', disabled); | 1802 | this.$el.prop('disabled', disabled); |
2329 | 1803 | this.$element.css('color', disabled ? 'grey' : ''); | 1803 | this.$el.css('color', disabled ? 'grey' : ''); |
2330 | 1804 | } | 1804 | } |
2331 | 1805 | }); | 1805 | }); |
2332 | 1806 | 1806 | ||
2333 | @@ -1929,14 +1929,14 @@ | |||
2334 | 1929 | var self = this; | 1929 | var self = this; |
2335 | 1930 | this._super(); | 1930 | this._super(); |
2336 | 1931 | if (this.field.translate) { | 1931 | if (this.field.translate) { |
2339 | 1932 | this.$element.addClass('oe_form_field_translatable'); | 1932 | this.$el.addClass('oe_form_field_translatable'); |
2340 | 1933 | this.$element.find('.oe_field_translate').click(_.bind(function() { | 1933 | this.$el.find('.oe_field_translate').click(_.bind(function() { |
2341 | 1934 | this.field_manager.open_translate_dialog(this); | 1934 | this.field_manager.open_translate_dialog(this); |
2342 | 1935 | }, this)); | 1935 | }, this)); |
2343 | 1936 | } | 1936 | } |
2345 | 1937 | this.$label = this.view.$element.find('label[for=' + this.id_for_label + ']'); | 1937 | this.$label = this.view.$el.find('label[for=' + this.id_for_label + ']'); |
2346 | 1938 | if (instance.session.debug) { | 1938 | if (instance.session.debug) { |
2348 | 1939 | this.do_attach_tooltip(this, this.$label[0] || this.$element); | 1939 | this.do_attach_tooltip(this, this.$label[0] || this.$el); |
2349 | 1940 | this.$label.off('dblclick').on('dblclick', function() { | 1940 | this.$label.off('dblclick').on('dblclick', function() { |
2350 | 1941 | console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view); | 1941 | console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view); |
2351 | 1942 | window.w = self; | 1942 | window.w = self; |
2352 | @@ -1955,7 +1955,7 @@ | |||
2353 | 1955 | * Private. Do not use. | 1955 | * Private. Do not use. |
2354 | 1956 | */ | 1956 | */ |
2355 | 1957 | _set_required: function() { | 1957 | _set_required: function() { |
2357 | 1958 | this.$element.toggleClass('oe_form_required', this.get("required")); | 1958 | this.$el.toggleClass('oe_form_required', this.get("required")); |
2358 | 1959 | }, | 1959 | }, |
2359 | 1960 | set_value: function(value_) { | 1960 | set_value: function(value_) { |
2360 | 1961 | this._inhibit_on_change = true; | 1961 | this._inhibit_on_change = true; |
2361 | @@ -1980,11 +1980,11 @@ | |||
2362 | 1980 | }, | 1980 | }, |
2363 | 1981 | _check_css_flags: function() { | 1981 | _check_css_flags: function() { |
2364 | 1982 | if (this.field.translate) { | 1982 | if (this.field.translate) { |
2366 | 1983 | this.$element.find('.oe_field_translate').toggle(!this.field_manager.is_create_mode()); | 1983 | this.$el.find('.oe_field_translate').toggle(!this.field_manager.is_create_mode()); |
2367 | 1984 | } | 1984 | } |
2368 | 1985 | if (!this.disable_utility_classes) { | 1985 | if (!this.disable_utility_classes) { |
2369 | 1986 | if (this.field_manager.get('display_invalid_fields')) { | 1986 | if (this.field_manager.get('display_invalid_fields')) { |
2371 | 1987 | this.$element.toggleClass('oe_form_invalid', !this.is_valid()); | 1987 | this.$el.toggleClass('oe_form_invalid', !this.is_valid()); |
2372 | 1988 | } | 1988 | } |
2373 | 1989 | } | 1989 | } |
2374 | 1990 | }, | 1990 | }, |
2375 | @@ -2042,7 +2042,7 @@ | |||
2376 | 2042 | }, | 2042 | }, |
2377 | 2043 | initialize_content: function() { | 2043 | initialize_content: function() { |
2378 | 2044 | var self = this; | 2044 | var self = this; |
2380 | 2045 | var $input = this.$element.find('input'); | 2045 | var $input = this.$el.find('input'); |
2381 | 2046 | $input.change(function() { | 2046 | $input.change(function() { |
2382 | 2047 | self.set({'value': instance.web.parse_value($input.val(), self)}); | 2047 | self.set({'value': instance.web.parse_value($input.val(), self)}); |
2383 | 2048 | }); | 2048 | }); |
2384 | @@ -2055,18 +2055,18 @@ | |||
2385 | 2055 | render_value: function() { | 2055 | render_value: function() { |
2386 | 2056 | var show_value = instance.web.format_value(this.get('value'), this, ''); | 2056 | var show_value = instance.web.format_value(this.get('value'), this, ''); |
2387 | 2057 | if (!this.get("effective_readonly")) { | 2057 | if (!this.get("effective_readonly")) { |
2389 | 2058 | this.$element.find('input').val(show_value); | 2058 | this.$el.find('input').val(show_value); |
2390 | 2059 | } else { | 2059 | } else { |
2391 | 2060 | if (this.password) { | 2060 | if (this.password) { |
2392 | 2061 | show_value = new Array(show_value.length + 1).join('*'); | 2061 | show_value = new Array(show_value.length + 1).join('*'); |
2393 | 2062 | } | 2062 | } |
2395 | 2063 | this.$element.text(show_value); | 2063 | this.$el.text(show_value); |
2396 | 2064 | } | 2064 | } |
2397 | 2065 | }, | 2065 | }, |
2398 | 2066 | is_syntax_valid: function() { | 2066 | is_syntax_valid: function() { |
2399 | 2067 | if (!this.get("effective_readonly")) { | 2067 | if (!this.get("effective_readonly")) { |
2400 | 2068 | try { | 2068 | try { |
2402 | 2069 | var value_ = instance.web.parse_value(this.$element.find('input').val(), this, ''); | 2069 | var value_ = instance.web.parse_value(this.$el.find('input').val(), this, ''); |
2403 | 2070 | return true; | 2070 | return true; |
2404 | 2071 | } catch(e) { | 2071 | } catch(e) { |
2405 | 2072 | return false; | 2072 | return false; |
2406 | @@ -2090,7 +2090,7 @@ | |||
2407 | 2090 | template: 'FieldEmail', | 2090 | template: 'FieldEmail', |
2408 | 2091 | initialize_content: function() { | 2091 | initialize_content: function() { |
2409 | 2092 | this._super(); | 2092 | this._super(); |
2411 | 2093 | var $button = this.$element.find('button'); | 2093 | var $button = this.$el.find('button'); |
2412 | 2094 | $button.click(this.on_button_clicked); | 2094 | $button.click(this.on_button_clicked); |
2413 | 2095 | this.setupFocus($button); | 2095 | this.setupFocus($button); |
2414 | 2096 | }, | 2096 | }, |
2415 | @@ -2098,7 +2098,7 @@ | |||
2416 | 2098 | if (!this.get("effective_readonly")) { | 2098 | if (!this.get("effective_readonly")) { |
2417 | 2099 | this._super(); | 2099 | this._super(); |
2418 | 2100 | } else { | 2100 | } else { |
2420 | 2101 | this.$element.find('a') | 2101 | this.$el.find('a') |
2421 | 2102 | .attr('href', 'mailto:' + this.get('value')) | 2102 | .attr('href', 'mailto:' + this.get('value')) |
2422 | 2103 | .text(this.get('value') || ''); | 2103 | .text(this.get('value') || ''); |
2423 | 2104 | } | 2104 | } |
2424 | @@ -2116,7 +2116,7 @@ | |||
2425 | 2116 | template: 'FieldUrl', | 2116 | template: 'FieldUrl', |
2426 | 2117 | initialize_content: function() { | 2117 | initialize_content: function() { |
2427 | 2118 | this._super(); | 2118 | this._super(); |
2429 | 2119 | var $button = this.$element.find('button'); | 2119 | var $button = this.$el.find('button'); |
2430 | 2120 | $button.click(this.on_button_clicked); | 2120 | $button.click(this.on_button_clicked); |
2431 | 2121 | this.setupFocus($button); | 2121 | this.setupFocus($button); |
2432 | 2122 | }, | 2122 | }, |
2433 | @@ -2129,7 +2129,7 @@ | |||
2434 | 2129 | if (!s) { | 2129 | if (!s) { |
2435 | 2130 | tmp = "http://" + this.get('value'); | 2130 | tmp = "http://" + this.get('value'); |
2436 | 2131 | } | 2131 | } |
2438 | 2132 | this.$element.find('a').attr('href', tmp).text(this.get('value') ? tmp : ''); | 2132 | this.$el.find('a').attr('href', tmp).text(this.get('value') ? tmp : ''); |
2439 | 2133 | } | 2133 | } |
2440 | 2134 | }, | 2134 | }, |
2441 | 2135 | on_button_clicked: function() { | 2135 | on_button_clicked: function() { |
2442 | @@ -2178,8 +2178,8 @@ | |||
2443 | 2178 | }, | 2178 | }, |
2444 | 2179 | start: function() { | 2179 | start: function() { |
2445 | 2180 | var self = this; | 2180 | var self = this; |
2448 | 2181 | this.$input = this.$element.find('input.oe_datepicker_master'); | 2181 | this.$input = this.$el.find('input.oe_datepicker_master'); |
2449 | 2182 | this.$input_picker = this.$element.find('input.oe_datepicker_container'); | 2182 | this.$input_picker = this.$el.find('input.oe_datepicker_container'); |
2450 | 2183 | this.$input.change(this.on_change); | 2183 | this.$input.change(this.on_change); |
2451 | 2184 | this.picker({ | 2184 | this.picker({ |
2452 | 2185 | onClose: this.on_picker_select, | 2185 | onClose: this.on_picker_select, |
2453 | @@ -2189,7 +2189,7 @@ | |||
2454 | 2189 | showWeek: true, | 2189 | showWeek: true, |
2455 | 2190 | showButtonPanel: true | 2190 | showButtonPanel: true |
2456 | 2191 | }); | 2191 | }); |
2458 | 2192 | this.$element.find('img.oe_datepicker_trigger').click(function() { | 2192 | this.$el.find('img.oe_datepicker_trigger').click(function() { |
2459 | 2193 | if (self.get("effective_readonly") || self.picker('widget').is(':visible')) { | 2193 | if (self.get("effective_readonly") || self.picker('widget').is(':visible')) { |
2460 | 2194 | self.$input.focus(); | 2194 | self.$input.focus(); |
2461 | 2195 | return; | 2195 | return; |
2462 | @@ -2226,7 +2226,7 @@ | |||
2463 | 2226 | set_readonly: function(readonly) { | 2226 | set_readonly: function(readonly) { |
2464 | 2227 | this.readonly = readonly; | 2227 | this.readonly = readonly; |
2465 | 2228 | this.$input.prop('readonly', this.readonly); | 2228 | this.$input.prop('readonly', this.readonly); |
2467 | 2229 | this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly); | 2229 | this.$el.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly); |
2468 | 2230 | }, | 2230 | }, |
2469 | 2231 | is_valid_: function() { | 2231 | is_valid_: function() { |
2470 | 2232 | var value_ = this.$input.val(); | 2232 | var value_ = this.$input.val(); |
2471 | @@ -2276,7 +2276,7 @@ | |||
2472 | 2276 | this.datewidget.on_change.add_last(_.bind(function() { | 2276 | this.datewidget.on_change.add_last(_.bind(function() { |
2473 | 2277 | this.set({'value': this.datewidget.get_value()}); | 2277 | this.set({'value': this.datewidget.get_value()}); |
2474 | 2278 | }, this)); | 2278 | }, this)); |
2476 | 2279 | this.datewidget.appendTo(this.$element); | 2279 | this.datewidget.appendTo(this.$el); |
2477 | 2280 | this.setupFocus(this.datewidget.$input); | 2280 | this.setupFocus(this.datewidget.$input); |
2478 | 2281 | } | 2281 | } |
2479 | 2282 | }, | 2282 | }, |
2480 | @@ -2288,7 +2288,7 @@ | |||
2481 | 2288 | if (!this.get("effective_readonly")) { | 2288 | if (!this.get("effective_readonly")) { |
2482 | 2289 | this.datewidget.set_value(this.get('value')); | 2289 | this.datewidget.set_value(this.get('value')); |
2483 | 2290 | } else { | 2290 | } else { |
2485 | 2291 | this.$element.text(instance.web.format_value(this.get('value'), this, '')); | 2291 | this.$el.text(instance.web.format_value(this.get('value'), this, '')); |
2486 | 2292 | } | 2292 | } |
2487 | 2293 | }, | 2293 | }, |
2488 | 2294 | is_syntax_valid: function() { | 2294 | is_syntax_valid: function() { |
2489 | @@ -2317,7 +2317,7 @@ | |||
2490 | 2317 | instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { | 2317 | instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { |
2491 | 2318 | template: 'FieldText', | 2318 | template: 'FieldText', |
2492 | 2319 | initialize_content: function() { | 2319 | initialize_content: function() { |
2494 | 2320 | this.$textarea = this.$element.find('textarea'); | 2320 | this.$textarea = this.$el.find('textarea'); |
2495 | 2321 | if (!this.get("effective_readonly")) { | 2321 | if (!this.get("effective_readonly")) { |
2496 | 2322 | this.$textarea.change(_.bind(function() { | 2322 | this.$textarea.change(_.bind(function() { |
2497 | 2323 | this.set({'value': instance.web.parse_value(this.$textarea.val(), this)}); | 2323 | this.set({'value': instance.web.parse_value(this.$textarea.val(), this)}); |
2498 | @@ -2325,7 +2325,7 @@ | |||
2499 | 2325 | } else { | 2325 | } else { |
2500 | 2326 | this.$textarea.attr('disabled', 'disabled'); | 2326 | this.$textarea.attr('disabled', 'disabled'); |
2501 | 2327 | } | 2327 | } |
2503 | 2328 | this.$element.keyup(function (e) { | 2328 | this.$el.keyup(function (e) { |
2504 | 2329 | if (e.which === $.ui.keyCode.ENTER) { | 2329 | if (e.which === $.ui.keyCode.ENTER) { |
2505 | 2330 | e.stopPropagation(); | 2330 | e.stopPropagation(); |
2506 | 2331 | } | 2331 | } |
2507 | @@ -2357,7 +2357,7 @@ | |||
2508 | 2357 | is_false: function() { | 2357 | is_false: function() { |
2509 | 2358 | return this.get('value') === '' || this._super(); | 2358 | return this.get('value') === '' || this._super(); |
2510 | 2359 | }, | 2359 | }, |
2512 | 2360 | focus: function($element) { | 2360 | focus: function($el) { |
2513 | 2361 | this.$textarea.focus(); | 2361 | this.$textarea.focus(); |
2514 | 2362 | }, | 2362 | }, |
2515 | 2363 | do_resize: function(max_height) { | 2363 | do_resize: function(max_height) { |
2516 | @@ -2402,7 +2402,7 @@ | |||
2517 | 2402 | var self = this; | 2402 | var self = this; |
2518 | 2403 | if (! this.get("effective_readonly")) { | 2403 | if (! this.get("effective_readonly")) { |
2519 | 2404 | self._updating_editor = false; | 2404 | self._updating_editor = false; |
2521 | 2405 | this.$textarea = this.$element.find('textarea'); | 2405 | this.$textarea = this.$el.find('textarea'); |
2522 | 2406 | var width = ((this.node.attrs || {}).editor_width || 468); | 2406 | var width = ((this.node.attrs || {}).editor_width || 468); |
2523 | 2407 | var height = ((this.node.attrs || {}).editor_height || 100); | 2407 | var height = ((this.node.attrs || {}).editor_height || 100); |
2524 | 2408 | this.$textarea.cleditor({ | 2408 | this.$textarea.cleditor({ |
2525 | @@ -2435,7 +2435,7 @@ | |||
2526 | 2435 | this.$cleditor.updateFrame(); | 2435 | this.$cleditor.updateFrame(); |
2527 | 2436 | this._updating_editor = false; | 2436 | this._updating_editor = false; |
2528 | 2437 | } else { | 2437 | } else { |
2530 | 2438 | this.$element.html(this.get('value')); | 2438 | this.$el.html(this.get('value')); |
2531 | 2439 | } | 2439 | } |
2532 | 2440 | }, | 2440 | }, |
2533 | 2441 | }); | 2441 | }); |
2534 | @@ -2445,9 +2445,9 @@ | |||
2535 | 2445 | start: function() { | 2445 | start: function() { |
2536 | 2446 | var self = this; | 2446 | var self = this; |
2537 | 2447 | this._super.apply(this, arguments); | 2447 | this._super.apply(this, arguments); |
2539 | 2448 | this.$checkbox = $("input", this.$element); | 2448 | this.$checkbox = $("input", this.$el); |
2540 | 2449 | this.setupFocus(this.$checkbox); | 2449 | this.setupFocus(this.$checkbox); |
2542 | 2450 | this.$element.click(_.bind(function() { | 2450 | this.$el.click(_.bind(function() { |
2543 | 2451 | this.set({'value': this.$checkbox.is(':checked')}); | 2451 | this.set({'value': this.$checkbox.is(':checked')}); |
2544 | 2452 | }, this)); | 2452 | }, this)); |
2545 | 2453 | var check_readonly = function() { | 2453 | var check_readonly = function() { |
2546 | @@ -2469,7 +2469,7 @@ | |||
2547 | 2469 | template: 'FieldProgressBar', | 2469 | template: 'FieldProgressBar', |
2548 | 2470 | start: function() { | 2470 | start: function() { |
2549 | 2471 | this._super.apply(this, arguments); | 2471 | this._super.apply(this, arguments); |
2551 | 2472 | this.$element.progressbar({ | 2472 | this.$el.progressbar({ |
2552 | 2473 | value: this.get('value'), | 2473 | value: this.get('value'), |
2553 | 2474 | disabled: this.get("effective_readonly") | 2474 | disabled: this.get("effective_readonly") |
2554 | 2475 | }); | 2475 | }); |
2555 | @@ -2481,7 +2481,7 @@ | |||
2556 | 2481 | show_value = 0; | 2481 | show_value = 0; |
2557 | 2482 | } | 2482 | } |
2558 | 2483 | var formatted_value = instance.web.format_value(show_value, { type : 'float' }, '0'); | 2483 | var formatted_value = instance.web.format_value(show_value, { type : 'float' }, '0'); |
2560 | 2484 | this.$element.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%'); | 2484 | this.$el.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%'); |
2561 | 2485 | } | 2485 | } |
2562 | 2486 | }); | 2486 | }); |
2563 | 2487 | 2487 | ||
2564 | @@ -2512,9 +2512,9 @@ | |||
2565 | 2512 | // changing the selected value), takes the action as validating the | 2512 | // changing the selected value), takes the action as validating the |
2566 | 2513 | // row | 2513 | // row |
2567 | 2514 | var ischanging = false; | 2514 | var ischanging = false; |
2569 | 2515 | var $select = this.$element.find('select') | 2515 | var $select = this.$el.find('select') |
2570 | 2516 | .change(_.bind(function() { | 2516 | .change(_.bind(function() { |
2572 | 2517 | this.set({'value': this.values[this.$element.find('select')[0].selectedIndex][0]}); | 2517 | this.set({'value': this.values[this.$el.find('select')[0].selectedIndex][0]}); |
2573 | 2518 | }, this)) | 2518 | }, this)) |
2574 | 2519 | .change(function () { ischanging = true; }) | 2519 | .change(function () { ischanging = true; }) |
2575 | 2520 | .click(function () { ischanging = false; }) | 2520 | .click(function () { ischanging = false; }) |
2576 | @@ -2537,23 +2537,23 @@ | |||
2577 | 2537 | for (var i = 0, ii = this.values.length; i < ii; i++) { | 2537 | for (var i = 0, ii = this.values.length; i < ii; i++) { |
2578 | 2538 | if (this.values[i][0] === this.get('value')) index = i; | 2538 | if (this.values[i][0] === this.get('value')) index = i; |
2579 | 2539 | } | 2539 | } |
2581 | 2540 | this.$element.find('select')[0].selectedIndex = index; | 2540 | this.$el.find('select')[0].selectedIndex = index; |
2582 | 2541 | } else { | 2541 | } else { |
2583 | 2542 | var self = this; | 2542 | var self = this; |
2584 | 2543 | var option = _(this.values) | 2543 | var option = _(this.values) |
2585 | 2544 | .detect(function (record) { return record[0] === self.get('value'); }); | 2544 | .detect(function (record) { return record[0] === self.get('value'); }); |
2587 | 2545 | this.$element.text(option ? option[1] : this.values[0][1]); | 2545 | this.$el.text(option ? option[1] : this.values[0][1]); |
2588 | 2546 | } | 2546 | } |
2589 | 2547 | }, | 2547 | }, |
2590 | 2548 | is_syntax_valid: function() { | 2548 | is_syntax_valid: function() { |
2591 | 2549 | if (this.get("effective_readonly")) { | 2549 | if (this.get("effective_readonly")) { |
2592 | 2550 | return true; | 2550 | return true; |
2593 | 2551 | } | 2551 | } |
2595 | 2552 | var value_ = this.values[this.$element.find('select')[0].selectedIndex]; | 2552 | var value_ = this.values[this.$el.find('select')[0].selectedIndex]; |
2596 | 2553 | return !! value_; | 2553 | return !! value_; |
2597 | 2554 | }, | 2554 | }, |
2598 | 2555 | focus: function() { | 2555 | focus: function() { |
2600 | 2556 | this.$element.find('select:first').focus(); | 2556 | this.$el.find('select:first').focus(); |
2601 | 2557 | } | 2557 | } |
2602 | 2558 | }); | 2558 | }); |
2603 | 2559 | 2559 | ||
2604 | @@ -2641,7 +2641,7 @@ | |||
2605 | 2641 | } | 2641 | } |
2606 | 2642 | // create... | 2642 | // create... |
2607 | 2643 | values.push({label: _t("<em> Create and Edit...</em>"), action: function() { | 2643 | values.push({label: _t("<em> Create and Edit...</em>"), action: function() { |
2609 | 2644 | self._search_create_popup("form", undefined, {}); | 2644 | self._search_create_popup("form", undefined, self._create_context(search_val)); |
2610 | 2645 | }}); | 2645 | }}); |
2611 | 2646 | 2646 | ||
2612 | 2647 | return values; | 2647 | return values; |
2613 | @@ -2653,7 +2653,7 @@ | |||
2614 | 2653 | _quick_create: function(name) { | 2653 | _quick_create: function(name) { |
2615 | 2654 | var self = this; | 2654 | var self = this; |
2616 | 2655 | var slow_create = function () { | 2655 | var slow_create = function () { |
2618 | 2656 | self._search_create_popup("form", undefined, {"default_name": name}); | 2656 | self._search_create_popup("form", undefined, self._create_context(name)); |
2619 | 2657 | }; | 2657 | }; |
2620 | 2658 | if (self.options.quick_create === undefined || self.options.quick_create) { | 2658 | if (self.options.quick_create === undefined || self.options.quick_create) { |
2621 | 2659 | new instance.web.DataSet(this, this.field.relation, self.build_context()) | 2659 | new instance.web.DataSet(this, this.field.relation, self.build_context()) |
2622 | @@ -2690,6 +2690,13 @@ | |||
2623 | 2690 | * To implement. | 2690 | * To implement. |
2624 | 2691 | */ | 2691 | */ |
2625 | 2692 | add_id: function(id) {}, | 2692 | add_id: function(id) {}, |
2626 | 2693 | _create_context: function(name) { | ||
2627 | 2694 | var tmp = {}; | ||
2628 | 2695 | var field = (this.options || {}).create_name_field; | ||
2629 | 2696 | if (field) | ||
2630 | 2697 | tmp["default_" + field] = name; | ||
2631 | 2698 | return tmp; | ||
2632 | 2699 | }, | ||
2633 | 2693 | }; | 2700 | }; |
2634 | 2694 | 2701 | ||
2635 | 2695 | instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, { | 2702 | instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, { |
2636 | @@ -2724,7 +2731,7 @@ | |||
2637 | 2724 | }, | 2731 | }, |
2638 | 2725 | render_editable: function() { | 2732 | render_editable: function() { |
2639 | 2726 | var self = this; | 2733 | var self = this; |
2641 | 2727 | this.$input = this.$element.find("input"); | 2734 | this.$input = this.$el.find("input"); |
2642 | 2728 | 2735 | ||
2643 | 2729 | self.$input.tipsy({ | 2736 | self.$input.tipsy({ |
2644 | 2730 | title: function() { | 2737 | title: function() { |
2645 | @@ -2744,8 +2751,8 @@ | |||
2646 | 2744 | self.$input.tipsy("hide"); | 2751 | self.$input.tipsy("hide"); |
2647 | 2745 | }); | 2752 | }); |
2648 | 2746 | 2753 | ||
2651 | 2747 | this.$drop_down = this.$element.find(".oe_m2o_drop_down_button"); | 2754 | this.$drop_down = this.$el.find(".oe_m2o_drop_down_button"); |
2652 | 2748 | this.$follow_button = $(".oe_m2o_cm_button", this.$element); | 2755 | this.$follow_button = $(".oe_m2o_cm_button", this.$el); |
2653 | 2749 | 2756 | ||
2654 | 2750 | this.$follow_button.click(function() { | 2757 | this.$follow_button.click(function() { |
2655 | 2751 | if (!self.get('value')) { | 2758 | if (!self.get('value')) { |
2656 | @@ -2919,7 +2926,7 @@ | |||
2657 | 2919 | if (follow) | 2926 | if (follow) |
2658 | 2920 | link += "<br />"; | 2927 | link += "<br />"; |
2659 | 2921 | } | 2928 | } |
2661 | 2922 | var $link = this.$element.find('.oe_form_uri') | 2929 | var $link = this.$el.find('.oe_form_uri') |
2662 | 2923 | .unbind('click') | 2930 | .unbind('click') |
2663 | 2924 | .html(link); | 2931 | .html(link); |
2664 | 2925 | if (! this.options.no_open) | 2932 | if (! this.options.no_open) |
2665 | @@ -2934,7 +2941,7 @@ | |||
2666 | 2934 | }); | 2941 | }); |
2667 | 2935 | return false; | 2942 | return false; |
2668 | 2936 | }); | 2943 | }); |
2670 | 2937 | $(".oe_form_m2o_follow", this.$element).html(follow); | 2944 | $(".oe_form_m2o_follow", this.$el).html(follow); |
2671 | 2938 | } | 2945 | } |
2672 | 2939 | }, | 2946 | }, |
2673 | 2940 | set_value: function(value_) { | 2947 | set_value: function(value_) { |
2674 | @@ -3035,7 +3042,7 @@ | |||
2675 | 3035 | }, | 3042 | }, |
2676 | 3036 | start: function() { | 3043 | start: function() { |
2677 | 3037 | this._super.apply(this, arguments); | 3044 | this._super.apply(this, arguments); |
2679 | 3038 | this.$element.addClass('oe_form_field oe_form_field_one2many'); | 3045 | this.$el.addClass('oe_form_field oe_form_field_one2many'); |
2680 | 3039 | 3046 | ||
2681 | 3040 | var self = this; | 3047 | var self = this; |
2682 | 3041 | 3048 | ||
2683 | @@ -3145,7 +3152,7 @@ | |||
2684 | 3145 | } | 3152 | } |
2685 | 3146 | } else if (view_type === "form") { | 3153 | } else if (view_type === "form") { |
2686 | 3147 | if (self.get("effective_readonly")) { | 3154 | if (self.get("effective_readonly")) { |
2688 | 3148 | $(".oe_form_buttons", controller.$element).children().remove(); | 3155 | $(".oe_form_buttons", controller.$el).children().remove(); |
2689 | 3149 | } | 3156 | } |
2690 | 3150 | controller.on_record_loaded.add_last(function() { | 3157 | controller.on_record_loaded.add_last(function() { |
2691 | 3151 | once.resolve(); | 3158 | once.resolve(); |
2692 | @@ -3166,7 +3173,7 @@ | |||
2693 | 3166 | }); | 3173 | }); |
2694 | 3167 | this.is_setted.then(function() { | 3174 | this.is_setted.then(function() { |
2695 | 3168 | $.async_when().then(function () { | 3175 | $.async_when().then(function () { |
2697 | 3169 | self.viewmanager.appendTo(self.$element); | 3176 | self.viewmanager.appendTo(self.$el); |
2698 | 3170 | }); | 3177 | }); |
2699 | 3171 | }); | 3178 | }); |
2700 | 3172 | return def; | 3179 | return def; |
2701 | @@ -3387,7 +3394,7 @@ | |||
2702 | 3387 | }, | 3394 | }, |
2703 | 3388 | start: function () { | 3395 | start: function () { |
2704 | 3389 | var ret = this._super(); | 3396 | var ret = this._super(); |
2706 | 3390 | this.$element | 3397 | this.$el |
2707 | 3391 | .off('mousedown.handleButtons') | 3398 | .off('mousedown.handleButtons') |
2708 | 3392 | .on('mousedown.handleButtons', 'table button', this.proxy('_button_down')); | 3399 | .on('mousedown.handleButtons', 'table button', this.proxy('_button_down')); |
2709 | 3393 | return ret; | 3400 | return ret; |
2710 | @@ -3401,7 +3408,7 @@ | |||
2711 | 3401 | // If the form has not been modified, the view can only be valid | 3408 | // If the form has not been modified, the view can only be valid |
2712 | 3402 | // NB: is_dirty will also be set on defaults/onchanges/whatever? | 3409 | // NB: is_dirty will also be set on defaults/onchanges/whatever? |
2713 | 3403 | // oe_form_dirty seems to only be set on actual user actions | 3410 | // oe_form_dirty seems to only be set on actual user actions |
2715 | 3404 | if (!form.$element.is('.oe_form_dirty')) { | 3411 | if (!form.$el.is('.oe_form_dirty')) { |
2716 | 3405 | return true; | 3412 | return true; |
2717 | 3406 | } | 3413 | } |
2718 | 3407 | this.o2m._dirty_flag = true; | 3414 | this.o2m._dirty_flag = true; |
2719 | @@ -3515,7 +3522,7 @@ | |||
2720 | 3515 | return; | 3522 | return; |
2721 | 3516 | } | 3523 | } |
2722 | 3517 | // FIXME: why isn't there an API for this? | 3524 | // FIXME: why isn't there an API for this? |
2724 | 3518 | if (this.editor.form.$element.hasClass('oe_form_dirty')) { | 3525 | if (this.editor.form.$el.hasClass('oe_form_dirty')) { |
2725 | 3519 | this.save_edition(); | 3526 | this.save_edition(); |
2726 | 3520 | return; | 3527 | return; |
2727 | 3521 | } | 3528 | } |
2728 | @@ -3643,7 +3650,7 @@ | |||
2729 | 3643 | if (this.get("effective_readonly")) | 3650 | if (this.get("effective_readonly")) |
2730 | 3644 | return; | 3651 | return; |
2731 | 3645 | var self = this; | 3652 | var self = this; |
2733 | 3646 | self.$text = $("textarea", this.$element); | 3653 | self.$text = $("textarea", this.$el); |
2734 | 3647 | self.$text.textext({ | 3654 | self.$text.textext({ |
2735 | 3648 | plugins : 'tags arrow autocomplete', | 3655 | plugins : 'tags arrow autocomplete', |
2736 | 3649 | autocomplete: { | 3656 | autocomplete: { |
2737 | @@ -3701,7 +3708,7 @@ | |||
2738 | 3701 | self._drop_shown = true; | 3708 | self._drop_shown = true; |
2739 | 3702 | }); | 3709 | }); |
2740 | 3703 | self.tags = self.$text.textext()[0].tags(); | 3710 | self.tags = self.$text.textext()[0].tags(); |
2742 | 3704 | $("textarea", this.$element).focusout(function() { | 3711 | $("textarea", this.$el).focusout(function() { |
2743 | 3705 | self.$text.trigger("setInputData", ""); | 3712 | self.$text.trigger("setInputData", ""); |
2744 | 3706 | }).keydown(function(e) { | 3713 | }).keydown(function(e) { |
2745 | 3707 | if (e.which === $.ui.keyCode.TAB && self._drop_shown) { | 3714 | if (e.which === $.ui.keyCode.TAB && self._drop_shown) { |
2746 | @@ -3735,10 +3742,10 @@ | |||
2747 | 3735 | data = _.map(values, function(el) { return indexed[el]; }); | 3742 | data = _.map(values, function(el) { return indexed[el]; }); |
2748 | 3736 | if (! self.get("effective_readonly")) { | 3743 | if (! self.get("effective_readonly")) { |
2749 | 3737 | self.tags.containerElement().children().remove(); | 3744 | self.tags.containerElement().children().remove(); |
2751 | 3738 | $("textarea", self.$element).css("padding-left", "3px"); | 3745 | $("textarea", self.$el).css("padding-left", "3px"); |
2752 | 3739 | self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};})); | 3746 | self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};})); |
2753 | 3740 | } else { | 3747 | } else { |
2755 | 3741 | self.$element.html(QWeb.render("FieldMany2ManyTag", {elements: data})); | 3748 | self.$el.html(QWeb.render("FieldMany2ManyTag", {elements: data})); |
2756 | 3742 | } | 3749 | } |
2757 | 3743 | }; | 3750 | }; |
2758 | 3744 | if (! values || values.length > 0) { | 3751 | if (! values || values.length > 0) { |
2759 | @@ -3766,7 +3773,7 @@ | |||
2760 | 3766 | }, | 3773 | }, |
2761 | 3767 | start: function() { | 3774 | start: function() { |
2762 | 3768 | this._super.apply(this, arguments); | 3775 | this._super.apply(this, arguments); |
2764 | 3769 | this.$element.addClass('oe_form_field oe_form_field_many2many'); | 3776 | this.$el.addClass('oe_form_field oe_form_field_many2many'); |
2765 | 3770 | 3777 | ||
2766 | 3771 | var self = this; | 3778 | var self = this; |
2767 | 3772 | 3779 | ||
2768 | @@ -3829,7 +3836,7 @@ | |||
2769 | 3829 | loaded.resolve(); | 3836 | loaded.resolve(); |
2770 | 3830 | }); | 3837 | }); |
2771 | 3831 | $.async_when().then(function () { | 3838 | $.async_when().then(function () { |
2773 | 3832 | self.list_view.appendTo(self.$element); | 3839 | self.list_view.appendTo(self.$el); |
2774 | 3833 | }); | 3840 | }); |
2775 | 3834 | return loaded; | 3841 | return loaded; |
2776 | 3835 | }, | 3842 | }, |
2777 | @@ -3957,7 +3964,7 @@ | |||
2778 | 3957 | }); | 3964 | }); |
2779 | 3958 | this.kanban_view.do_switch_view.add_last(_.bind(this.open_popup, this)); | 3965 | this.kanban_view.do_switch_view.add_last(_.bind(this.open_popup, this)); |
2780 | 3959 | $.async_when().then(function () { | 3966 | $.async_when().then(function () { |
2782 | 3960 | self.kanban_view.appendTo(self.$element); | 3967 | self.kanban_view.appendTo(self.$el); |
2783 | 3961 | }); | 3968 | }); |
2784 | 3962 | return loaded; | 3969 | return loaded; |
2785 | 3963 | }, | 3970 | }, |
2786 | @@ -4041,7 +4048,7 @@ | |||
2787 | 4041 | }, | 4048 | }, |
2788 | 4042 | start: function () { | 4049 | start: function () { |
2789 | 4043 | var self = this; | 4050 | var self = this; |
2791 | 4044 | self.$text = this.$element.find('input').css("width", "200px"); | 4051 | self.$text = this.$el.find('input').css("width", "200px"); |
2792 | 4045 | self.$text.textext({ | 4052 | self.$text.textext({ |
2793 | 4046 | plugins : 'arrow autocomplete', | 4053 | plugins : 'arrow autocomplete', |
2794 | 4047 | autocomplete: { | 4054 | autocomplete: { |
2795 | @@ -4149,8 +4156,8 @@ | |||
2796 | 4149 | }, | 4156 | }, |
2797 | 4150 | title: this.options.title || "", | 4157 | title: this.options.title || "", |
2798 | 4151 | buttons: [{text:"tmp"}], | 4158 | buttons: [{text:"tmp"}], |
2801 | 4152 | }, this.$element).open(); | 4159 | }, this.$el).open(); |
2802 | 4153 | this.$buttonpane = dialog.$element.dialog("widget").find(".ui-dialog-buttonpane").html(""); | 4160 | this.$buttonpane = dialog.$el.dialog("widget").find(".ui-dialog-buttonpane").html(""); |
2803 | 4154 | this.start(); | 4161 | this.start(); |
2804 | 4155 | }, | 4162 | }, |
2805 | 4156 | on_write_completed: function() {}, | 4163 | on_write_completed: function() {}, |
2806 | @@ -4173,7 +4180,7 @@ | |||
2807 | 4173 | if (this.options.alternative_form_view) { | 4180 | if (this.options.alternative_form_view) { |
2808 | 4174 | this.view_form.set_embedded_view(this.options.alternative_form_view); | 4181 | this.view_form.set_embedded_view(this.options.alternative_form_view); |
2809 | 4175 | } | 4182 | } |
2811 | 4176 | this.view_form.appendTo(this.$element.find(".oe_popup_form")); | 4183 | this.view_form.appendTo(this.$el.find(".oe_popup_form")); |
2812 | 4177 | this.view_form.on_loaded.add_last(function() { | 4184 | this.view_form.on_loaded.add_last(function() { |
2813 | 4178 | var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; | 4185 | var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; |
2814 | 4179 | self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { | 4186 | self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { |
2815 | @@ -4213,7 +4220,7 @@ | |||
2816 | 4213 | this.destroy(); | 4220 | this.destroy(); |
2817 | 4214 | }, | 4221 | }, |
2818 | 4215 | destroy: function () { | 4222 | destroy: function () { |
2820 | 4216 | this.$element.dialog('close'); | 4223 | this.$el.dialog('close'); |
2821 | 4217 | this._super(); | 4224 | this._super(); |
2822 | 4218 | }, | 4225 | }, |
2823 | 4219 | }); | 4226 | }); |
2824 | @@ -4305,7 +4312,7 @@ | |||
2825 | 4305 | e.cancel = true; | 4312 | e.cancel = true; |
2826 | 4306 | }); | 4313 | }); |
2827 | 4307 | self.view_list.popup = self; | 4314 | self.view_list.popup = self; |
2829 | 4308 | self.view_list.appendTo($(".oe_popup_list", self.$element)).pipe(function() { | 4315 | self.view_list.appendTo($(".oe_popup_list", self.$el)).pipe(function() { |
2830 | 4309 | self.view_list.do_show(); | 4316 | self.view_list.do_show(); |
2831 | 4310 | }).pipe(function() { | 4317 | }).pipe(function() { |
2832 | 4311 | self.searchview.do_search(); | 4318 | self.searchview.do_search(); |
2833 | @@ -4323,7 +4330,7 @@ | |||
2834 | 4323 | }); | 4330 | }); |
2835 | 4324 | }); | 4331 | }); |
2836 | 4325 | }); | 4332 | }); |
2838 | 4326 | this.searchview.appendTo($(".oe_popup_list", self.$element)); | 4333 | this.searchview.appendTo($(".oe_popup_list", self.$el)); |
2839 | 4327 | }, | 4334 | }, |
2840 | 4328 | do_search: function(domains, contexts, groupbys) { | 4335 | do_search: function(domains, contexts, groupbys) { |
2841 | 4329 | var self = this; | 4336 | var self = this; |
2842 | @@ -4349,7 +4356,7 @@ | |||
2843 | 4349 | this.searchview.hide(); | 4356 | this.searchview.hide(); |
2844 | 4350 | } | 4357 | } |
2845 | 4351 | if (this.view_list) { | 4358 | if (this.view_list) { |
2847 | 4352 | this.view_list.$element.hide(); | 4359 | this.view_list.$el.hide(); |
2848 | 4353 | } | 4360 | } |
2849 | 4354 | this.setup_form_view(); | 4361 | this.setup_form_view(); |
2850 | 4355 | }, | 4362 | }, |
2851 | @@ -4382,7 +4389,7 @@ | |||
2852 | 4382 | var sel = this.selection.get_value(); | 4389 | var sel = this.selection.get_value(); |
2853 | 4383 | this.m2o.field.relation = sel; | 4390 | this.m2o.field.relation = sel; |
2854 | 4384 | this.m2o.set_value(false); | 4391 | this.m2o.set_value(false); |
2856 | 4385 | this.m2o.$element.toggle(sel !== false); | 4392 | this.m2o.$el.toggle(sel !== false); |
2857 | 4386 | } | 4393 | } |
2858 | 4387 | }, | 4394 | }, |
2859 | 4388 | destroy_content: function() { | 4395 | destroy_content: function() { |
2860 | @@ -4486,9 +4493,9 @@ | |||
2861 | 4486 | this._super.apply(this, arguments); | 4493 | this._super.apply(this, arguments); |
2862 | 4487 | }, | 4494 | }, |
2863 | 4488 | initialize_content: function() { | 4495 | initialize_content: function() { |
2867 | 4489 | this.$element.find('input.oe_form_binary_file').change(this.on_file_change); | 4496 | this.$el.find('input.oe_form_binary_file').change(this.on_file_change); |
2868 | 4490 | this.$element.find('button.oe_form_binary_file_save').click(this.on_save_as); | 4497 | this.$el.find('button.oe_form_binary_file_save').click(this.on_save_as); |
2869 | 4491 | this.$element.find('.oe_form_binary_file_clear').click(this.on_clear); | 4498 | this.$el.find('.oe_form_binary_file_clear').click(this.on_clear); |
2870 | 4492 | }, | 4499 | }, |
2871 | 4493 | human_filesize : function(size) { | 4500 | human_filesize : function(size) { |
2872 | 4494 | var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | 4501 | var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
2873 | @@ -4505,10 +4512,10 @@ | |||
2874 | 4505 | // http://deepliquid.com/projects/Jcrop/demos.php?demo=handler | 4512 | // http://deepliquid.com/projects/Jcrop/demos.php?demo=handler |
2875 | 4506 | 4513 | ||
2876 | 4507 | if ($(e.target).val() !== '') { | 4514 | if ($(e.target).val() !== '') { |
2881 | 4508 | this.$element.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id); | 4515 | this.$el.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id); |
2882 | 4509 | this.$element.find('form.oe_form_binary_form').submit(); | 4516 | this.$el.find('form.oe_form_binary_form').submit(); |
2883 | 4510 | this.$element.find('.oe_form_binary_progress').show(); | 4517 | this.$el.find('.oe_form_binary_progress').show(); |
2884 | 4511 | this.$element.find('.oe_form_binary').hide(); | 4518 | this.$el.find('.oe_form_binary').hide(); |
2885 | 4512 | } | 4519 | } |
2886 | 4513 | }, | 4520 | }, |
2887 | 4514 | on_file_uploaded: function(size, name, content_type, file_base64) { | 4521 | on_file_uploaded: function(size, name, content_type, file_base64) { |
2888 | @@ -4520,8 +4527,8 @@ | |||
2889 | 4520 | this.filename = name; | 4527 | this.filename = name; |
2890 | 4521 | this.on_file_uploaded_and_valid.apply(this, arguments); | 4528 | this.on_file_uploaded_and_valid.apply(this, arguments); |
2891 | 4522 | } | 4529 | } |
2894 | 4523 | this.$element.find('.oe_form_binary_progress').hide(); | 4530 | this.$el.find('.oe_form_binary_progress').hide(); |
2895 | 4524 | this.$element.find('.oe_form_binary').show(); | 4531 | this.$el.find('.oe_form_binary').show(); |
2896 | 4525 | }, | 4532 | }, |
2897 | 4526 | on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { | 4533 | on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { |
2898 | 4527 | }, | 4534 | }, |
2899 | @@ -4575,7 +4582,7 @@ | |||
2900 | 4575 | this._super(); | 4582 | this._super(); |
2901 | 4576 | if (this.get("effective_readonly")) { | 4583 | if (this.get("effective_readonly")) { |
2902 | 4577 | var self = this; | 4584 | var self = this; |
2904 | 4578 | this.$element.find('a').click(function() { | 4585 | this.$el.find('a').click(function() { |
2905 | 4579 | if (self.get('value')) { | 4586 | if (self.get('value')) { |
2906 | 4580 | self.on_save_as(); | 4587 | self.on_save_as(); |
2907 | 4581 | } | 4588 | } |
2908 | @@ -4595,12 +4602,12 @@ | |||
2909 | 4595 | } else { | 4602 | } else { |
2910 | 4596 | show_value = (this.get('value') != null && this.get('value') !== false) ? this.get('value') : ''; | 4603 | show_value = (this.get('value') != null && this.get('value') !== false) ? this.get('value') : ''; |
2911 | 4597 | } | 4604 | } |
2913 | 4598 | this.$element.find('input').eq(0).val(show_value); | 4605 | this.$el.find('input').eq(0).val(show_value); |
2914 | 4599 | } else { | 4606 | } else { |
2916 | 4600 | this.$element.find('a').show(!!this.get('value')); | 4607 | this.$el.find('a').show(!!this.get('value')); |
2917 | 4601 | if (this.get('value')) { | 4608 | if (this.get('value')) { |
2918 | 4602 | var show_value = _t("Download") + " " + (this.view.datarecord[this.node.attrs.filename] || ''); | 4609 | var show_value = _t("Download") + " " + (this.view.datarecord[this.node.attrs.filename] || ''); |
2920 | 4603 | this.$element.find('a').text(show_value); | 4610 | this.$el.find('a').text(show_value); |
2921 | 4604 | } | 4611 | } |
2922 | 4605 | } | 4612 | } |
2923 | 4606 | }, | 4613 | }, |
2924 | @@ -4608,7 +4615,7 @@ | |||
2925 | 4608 | this.binary_value = true; | 4615 | this.binary_value = true; |
2926 | 4609 | this.set({'value': file_base64}); | 4616 | this.set({'value': file_base64}); |
2927 | 4610 | var show_value = name + " (" + this.human_filesize(size) + ")"; | 4617 | var show_value = name + " (" + this.human_filesize(size) + ")"; |
2929 | 4611 | this.$element.find('input').eq(0).val(show_value); | 4618 | this.$el.find('input').eq(0).val(show_value); |
2930 | 4612 | this.set_filename(name); | 4619 | this.set_filename(name); |
2931 | 4613 | }, | 4620 | }, |
2932 | 4614 | set_filename: function(value_) { | 4621 | set_filename: function(value_) { |
2933 | @@ -4619,7 +4626,7 @@ | |||
2934 | 4619 | }, | 4626 | }, |
2935 | 4620 | on_clear: function() { | 4627 | on_clear: function() { |
2936 | 4621 | this._super.apply(this, arguments); | 4628 | this._super.apply(this, arguments); |
2938 | 4622 | this.$element.find('input').eq(0).val(''); | 4629 | this.$el.find('input').eq(0).val(''); |
2939 | 4623 | this.set_filename(''); | 4630 | this.set_filename(''); |
2940 | 4624 | } | 4631 | } |
2941 | 4625 | }); | 4632 | }); |
2942 | @@ -4646,8 +4653,8 @@ | |||
2943 | 4646 | url = "/web/static/src/img/placeholder.png"; | 4653 | url = "/web/static/src/img/placeholder.png"; |
2944 | 4647 | } | 4654 | } |
2945 | 4648 | var $img = $(QWeb.render("FieldBinaryImage-img", { widget: this, url: url })); | 4655 | var $img = $(QWeb.render("FieldBinaryImage-img", { widget: this, url: url })); |
2948 | 4649 | this.$element.find('> img').remove(); | 4656 | this.$el.find('> img').remove(); |
2949 | 4650 | this.$element.prepend($img); | 4657 | this.$el.prepend($img); |
2950 | 4651 | $img.load(function() { | 4658 | $img.load(function() { |
2951 | 4652 | if (! self.options.size) | 4659 | if (! self.options.size) |
2952 | 4653 | return; | 4660 | return; |
2953 | @@ -4685,11 +4692,11 @@ | |||
2954 | 4685 | // backward compatibility | 4692 | // backward compatibility |
2955 | 4686 | this.loaded = new $.Deferred(); | 4693 | this.loaded = new $.Deferred(); |
2956 | 4687 | if (this.options.clickable) { | 4694 | if (this.options.clickable) { |
2958 | 4688 | this.$element.on('click','li',this.on_click_stage); | 4695 | this.$el.on('click','li',this.on_click_stage); |
2959 | 4689 | } | 4696 | } |
2960 | 4690 | // TODO move the following into css :after | 4697 | // TODO move the following into css :after |
2963 | 4691 | if (this.$element.parent().is('header')) { | 4698 | if (this.$el.parent().is('header')) { |
2964 | 4692 | this.$element.after('<div class="oe_clear"/>'); | 4699 | this.$el.after('<div class="oe_clear"/>'); |
2965 | 4693 | } | 4700 | } |
2966 | 4694 | }, | 4701 | }, |
2967 | 4695 | set_value: function(value_) { | 4702 | set_value: function(value_) { |
2968 | @@ -4750,7 +4757,7 @@ | |||
2969 | 4750 | render_elements: function () { | 4757 | render_elements: function () { |
2970 | 4751 | var self = this; | 4758 | var self = this; |
2971 | 4752 | var content = instance.web.qweb.render("FieldStatus.content", {widget: this}); | 4759 | var content = instance.web.qweb.render("FieldStatus.content", {widget: this}); |
2973 | 4753 | this.$element.html(content); | 4760 | this.$el.html(content); |
2974 | 4754 | var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}"); | 4761 | var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}"); |
2975 | 4755 | var color = colors[this.selected_value]; | 4762 | var color = colors[this.selected_value]; |
2976 | 4756 | if (color) { | 4763 | if (color) { |
2977 | 4757 | 4764 | ||
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 | 145 | * @returns {$.Deferred} loading promise | 145 | * @returns {$.Deferred} loading promise |
2983 | 146 | */ | 146 | */ |
2984 | 147 | start: function() { | 147 | start: function() { |
2986 | 148 | this.$element.addClass('oe_list'); | 148 | this.$el.addClass('oe_list'); |
2987 | 149 | return this.reload_view(null, null, true); | 149 | return this.reload_view(null, null, true); |
2988 | 150 | }, | 150 | }, |
2989 | 151 | /** | 151 | /** |
2990 | @@ -248,20 +248,20 @@ | |||
2991 | 248 | 248 | ||
2992 | 249 | this.setup_columns(this.fields_view.fields, grouped); | 249 | this.setup_columns(this.fields_view.fields, grouped); |
2993 | 250 | 250 | ||
2996 | 251 | this.$element.html(QWeb.render(this._template, this)); | 251 | this.$el.html(QWeb.render(this._template, this)); |
2997 | 252 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 252 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
2998 | 253 | // Head hook | 253 | // Head hook |
2999 | 254 | // Selecting records | 254 | // Selecting records |
3003 | 255 | this.$element.find('.oe_list_record_selector').click(function(){ | 255 | this.$el.find('.oe_list_record_selector').click(function(){ |
3004 | 256 | self.$element.find('.oe_list_record_selector input').prop('checked', | 256 | self.$el.find('.oe_list_record_selector input').prop('checked', |
3005 | 257 | self.$element.find('.oe_list_record_selector').prop('checked') || false); | 257 | self.$el.find('.oe_list_record_selector').prop('checked') || false); |
3006 | 258 | var selection = self.groups.get_selection(); | 258 | var selection = self.groups.get_selection(); |
3007 | 259 | $(self.groups).trigger( | 259 | $(self.groups).trigger( |
3008 | 260 | 'selected', [selection.ids, selection.records]); | 260 | 'selected', [selection.ids, selection.records]); |
3009 | 261 | }); | 261 | }); |
3010 | 262 | 262 | ||
3011 | 263 | // Sorting columns | 263 | // Sorting columns |
3013 | 264 | this.$element.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) { | 264 | this.$el.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) { |
3014 | 265 | e.stopPropagation(); | 265 | e.stopPropagation(); |
3015 | 266 | var $this = $(this); | 266 | var $this = $(this); |
3016 | 267 | self.dataset.sort($this.data('id')); | 267 | self.dataset.sort($this.data('id')); |
3017 | @@ -281,7 +281,7 @@ | |||
3018 | 281 | if (this.options.$buttons) { | 281 | if (this.options.$buttons) { |
3019 | 282 | this.$buttons.appendTo(this.options.$buttons); | 282 | this.$buttons.appendTo(this.options.$buttons); |
3020 | 283 | } else { | 283 | } else { |
3022 | 284 | this.$element.find('.oe_list_buttons').replaceWith(this.$buttons); | 284 | this.$el.find('.oe_list_buttons').replaceWith(this.$buttons); |
3023 | 285 | } | 285 | } |
3024 | 286 | this.$buttons.find('.oe_list_add') | 286 | this.$buttons.find('.oe_list_add') |
3025 | 287 | .click(this.proxy('do_add_record')) | 287 | .click(this.proxy('do_add_record')) |
3026 | @@ -298,7 +298,7 @@ | |||
3027 | 298 | if (this.options.$buttons) { | 298 | if (this.options.$buttons) { |
3028 | 299 | this.$pager.appendTo(this.options.$pager); | 299 | this.$pager.appendTo(this.options.$pager); |
3029 | 300 | } else { | 300 | } else { |
3031 | 301 | this.$element.find('.oe_list_pager').replaceWith(this.$pager); | 301 | this.$el.find('.oe_list_pager').replaceWith(this.$pager); |
3032 | 302 | } | 302 | } |
3033 | 303 | 303 | ||
3034 | 304 | this.$pager | 304 | this.$pager |
3035 | @@ -357,7 +357,7 @@ | |||
3036 | 357 | { label: _t('Delete'), callback: this.do_delete_selected } | 357 | { label: _t('Delete'), callback: this.do_delete_selected } |
3037 | 358 | ]); | 358 | ]); |
3038 | 359 | this.sidebar.add_toolbar(this.fields_view.toolbar); | 359 | this.sidebar.add_toolbar(this.fields_view.toolbar); |
3040 | 360 | this.sidebar.$element.hide(); | 360 | this.sidebar.$el.hide(); |
3041 | 361 | } | 361 | } |
3042 | 362 | }, | 362 | }, |
3043 | 363 | /** | 363 | /** |
3044 | @@ -450,7 +450,7 @@ | |||
3045 | 450 | }, | 450 | }, |
3046 | 451 | do_hide: function () { | 451 | do_hide: function () { |
3047 | 452 | if (this.sidebar) { | 452 | if (this.sidebar) { |
3049 | 453 | this.sidebar.$element.hide(); | 453 | this.sidebar.$el.hide(); |
3050 | 454 | } | 454 | } |
3051 | 455 | if (this.$buttons) { | 455 | if (this.$buttons) { |
3052 | 456 | this.$buttons.hide(); | 456 | this.$buttons.hide(); |
3053 | @@ -490,10 +490,10 @@ | |||
3054 | 490 | */ | 490 | */ |
3055 | 491 | reload_content: function () { | 491 | reload_content: function () { |
3056 | 492 | var self = this; | 492 | var self = this; |
3058 | 493 | self.$element.find('.oe_list_record_selector').prop('checked', false); | 493 | self.$el.find('.oe_list_record_selector').prop('checked', false); |
3059 | 494 | this.records.reset(); | 494 | this.records.reset(); |
3060 | 495 | var reloaded = $.Deferred(); | 495 | var reloaded = $.Deferred(); |
3062 | 496 | this.$element.find('.oe_list_content').append( | 496 | this.$el.find('.oe_list_content').append( |
3063 | 497 | this.groups.render(function () { | 497 | this.groups.render(function () { |
3064 | 498 | if (self.dataset.index == null) { | 498 | if (self.dataset.index == null) { |
3065 | 499 | var has_one = false; | 499 | var has_one = false; |
3066 | @@ -595,7 +595,7 @@ | |||
3067 | 595 | if (!ids.length) { | 595 | if (!ids.length) { |
3068 | 596 | this.dataset.index = 0; | 596 | this.dataset.index = 0; |
3069 | 597 | if (this.sidebar) { | 597 | if (this.sidebar) { |
3071 | 598 | this.sidebar.$element.hide(); | 598 | this.sidebar.$el.hide(); |
3072 | 599 | } | 599 | } |
3073 | 600 | this.compute_aggregates(); | 600 | this.compute_aggregates(); |
3074 | 601 | return; | 601 | return; |
3075 | @@ -603,7 +603,7 @@ | |||
3076 | 603 | 603 | ||
3077 | 604 | this.dataset.index = _(this.dataset.ids).indexOf(ids[0]); | 604 | this.dataset.index = _(this.dataset.ids).indexOf(ids[0]); |
3078 | 605 | if (this.sidebar) { | 605 | if (this.sidebar) { |
3080 | 606 | this.sidebar.$element.show(); | 606 | this.sidebar.$el.show(); |
3081 | 607 | } | 607 | } |
3082 | 608 | 608 | ||
3083 | 609 | this.compute_aggregates(_(records).map(function (record) { | 609 | this.compute_aggregates(_(records).map(function (record) { |
3084 | @@ -763,7 +763,7 @@ | |||
3085 | 763 | }, | 763 | }, |
3086 | 764 | display_aggregates: function (aggregation) { | 764 | display_aggregates: function (aggregation) { |
3087 | 765 | var self = this; | 765 | var self = this; |
3089 | 766 | var $footer_cells = this.$element.find('.oe_list_footer'); | 766 | var $footer_cells = this.$el.find('.oe_list_footer'); |
3090 | 767 | _(this.aggregate_columns).each(function (column) { | 767 | _(this.aggregate_columns).each(function (column) { |
3091 | 768 | if (!column['function']) { | 768 | if (!column['function']) { |
3092 | 769 | return; | 769 | return; |
3093 | @@ -789,7 +789,7 @@ | |||
3094 | 789 | pad_columns: function (count, options) { | 789 | pad_columns: function (count, options) { |
3095 | 790 | options = options || {}; | 790 | options = options || {}; |
3096 | 791 | // padding for action/pager header | 791 | // padding for action/pager header |
3098 | 792 | var $first_header = this.$element.find('thead tr:first th'); | 792 | var $first_header = this.$el.find('thead tr:first th'); |
3099 | 793 | var colspan = $first_header.attr('colspan'); | 793 | var colspan = $first_header.attr('colspan'); |
3100 | 794 | if (colspan) { | 794 | if (colspan) { |
3101 | 795 | if (!this.previous_colspan) { | 795 | if (!this.previous_colspan) { |
3102 | @@ -798,7 +798,7 @@ | |||
3103 | 798 | $first_header.attr('colspan', parseInt(colspan, 10) + count); | 798 | $first_header.attr('colspan', parseInt(colspan, 10) + count); |
3104 | 799 | } | 799 | } |
3105 | 800 | // Padding for column titles, footer and data rows | 800 | // Padding for column titles, footer and data rows |
3107 | 801 | var $rows = this.$element | 801 | var $rows = this.$el |
3108 | 802 | .find('.oe_list_header_columns, tr:not(thead tr)') | 802 | .find('.oe_list_header_columns, tr:not(thead tr)') |
3109 | 803 | .not(options['except']); | 803 | .not(options['except']); |
3110 | 804 | var newcols = new Array(count+1).join('<td class="oe_list_padding"></td>'); | 804 | var newcols = new Array(count+1).join('<td class="oe_list_padding"></td>'); |
3111 | @@ -812,23 +812,23 @@ | |||
3112 | 812 | * Removes all padding columns of the table | 812 | * Removes all padding columns of the table |
3113 | 813 | */ | 813 | */ |
3114 | 814 | unpad_columns: function () { | 814 | unpad_columns: function () { |
3116 | 815 | this.$element.find('.oe_list_padding').remove(); | 815 | this.$el.find('.oe_list_padding').remove(); |
3117 | 816 | if (this.previous_colspan) { | 816 | if (this.previous_colspan) { |
3119 | 817 | this.$element | 817 | this.$el |
3120 | 818 | .find('thead tr:first th') | 818 | .find('thead tr:first th') |
3121 | 819 | .attr('colspan', this.previous_colspan); | 819 | .attr('colspan', this.previous_colspan); |
3122 | 820 | this.previous_colspan = null; | 820 | this.previous_colspan = null; |
3123 | 821 | } | 821 | } |
3124 | 822 | }, | 822 | }, |
3125 | 823 | no_result: function () { | 823 | no_result: function () { |
3127 | 824 | this.$element.find('.oe_view_nocontent').remove(); | 824 | this.$el.find('.oe_view_nocontent').remove(); |
3128 | 825 | if (this.groups.group_by | 825 | if (this.groups.group_by |
3129 | 826 | || !this.options.action | 826 | || !this.options.action |
3130 | 827 | || !this.options.action.help) { | 827 | || !this.options.action.help) { |
3131 | 828 | return; | 828 | return; |
3132 | 829 | } | 829 | } |
3135 | 830 | this.$element.find('table:first').hide(); | 830 | this.$el.find('table:first').hide(); |
3136 | 831 | this.$element.prepend( | 831 | this.$el.prepend( |
3137 | 832 | $('<div class="oe_view_nocontent">').html(this.options.action.help) | 832 | $('<div class="oe_view_nocontent">').html(this.options.action.help) |
3138 | 833 | ); | 833 | ); |
3139 | 834 | } | 834 | } |
3140 | @@ -1478,27 +1478,27 @@ | |||
3141 | 1478 | }, | 1478 | }, |
3142 | 1479 | render: function (post_render) { | 1479 | render: function (post_render) { |
3143 | 1480 | var self = this; | 1480 | var self = this; |
3146 | 1481 | var $element = $('<tbody>'); | 1481 | var $el = $('<tbody>'); |
3147 | 1482 | this.elements = [$element[0]]; | 1482 | this.elements = [$el[0]]; |
3148 | 1483 | 1483 | ||
3149 | 1484 | this.datagroup.list( | 1484 | this.datagroup.list( |
3150 | 1485 | _(this.view.visible_columns).chain() | 1485 | _(this.view.visible_columns).chain() |
3151 | 1486 | .filter(function (column) { return column.tag === 'field' }) | 1486 | .filter(function (column) { return column.tag === 'field' }) |
3152 | 1487 | .pluck('name').value(), | 1487 | .pluck('name').value(), |
3153 | 1488 | function (groups) { | 1488 | function (groups) { |
3155 | 1489 | $element[0].appendChild( | 1489 | $el[0].appendChild( |
3156 | 1490 | self.render_groups(groups)); | 1490 | self.render_groups(groups)); |
3157 | 1491 | if (post_render) { post_render(); } | 1491 | if (post_render) { post_render(); } |
3158 | 1492 | }, function (dataset) { | 1492 | }, function (dataset) { |
3159 | 1493 | self.render_dataset(dataset).then(function (list) { | 1493 | self.render_dataset(dataset).then(function (list) { |
3160 | 1494 | self.children[null] = list; | 1494 | self.children[null] = list; |
3161 | 1495 | self.elements = | 1495 | self.elements = |
3163 | 1496 | [list.$current.replaceAll($element)[0]]; | 1496 | [list.$current.replaceAll($el)[0]]; |
3164 | 1497 | self.setup_resequence_rows(list, dataset); | 1497 | self.setup_resequence_rows(list, dataset); |
3165 | 1498 | if (post_render) { post_render(); } | 1498 | if (post_render) { post_render(); } |
3166 | 1499 | }); | 1499 | }); |
3167 | 1500 | }); | 1500 | }); |
3169 | 1501 | return $element; | 1501 | return $el; |
3170 | 1502 | }, | 1502 | }, |
3171 | 1503 | /** | 1503 | /** |
3172 | 1504 | * Returns the ids of all selected records for this group, and the records | 1504 | * Returns the ids of all selected records for this group, and the records |
3173 | 1505 | 1505 | ||
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 | 45 | } | 45 | } |
3179 | 46 | }); | 46 | }); |
3180 | 47 | this.on('edit:after', this, function () { | 47 | this.on('edit:after', this, function () { |
3182 | 48 | self.$element.add(self.$buttons).addClass('oe_editing'); | 48 | self.$el.add(self.$buttons).addClass('oe_editing'); |
3183 | 49 | }); | 49 | }); |
3184 | 50 | this.on('save:after cancel:after', this, function () { | 50 | this.on('save:after cancel:after', this, function () { |
3186 | 51 | self.$element.add(self.$buttons).removeClass('oe_editing'); | 51 | self.$el.add(self.$buttons).removeClass('oe_editing'); |
3187 | 52 | }); | 52 | }); |
3188 | 53 | }, | 53 | }, |
3189 | 54 | destroy: function () { | 54 | destroy: function () { |
3190 | @@ -87,8 +87,8 @@ | |||
3191 | 87 | */ | 87 | */ |
3192 | 88 | do_add_record: function () { | 88 | do_add_record: function () { |
3193 | 89 | if (this.editable()) { | 89 | if (this.editable()) { |
3196 | 90 | this.$element.find('table:first').show(); | 90 | this.$el.find('table:first').show(); |
3197 | 91 | this.$element.find('.oe_view_nocontent').remove(); | 91 | this.$el.find('.oe_view_nocontent').remove(); |
3198 | 92 | this.start_edition(); | 92 | this.start_edition(); |
3199 | 93 | } else { | 93 | } else { |
3200 | 94 | this._super(); | 94 | this._super(); |
3201 | @@ -99,7 +99,7 @@ | |||
3202 | 99 | // tree/@editable takes priority on everything else if present. | 99 | // tree/@editable takes priority on everything else if present. |
3203 | 100 | var result = this._super(data, grouped); | 100 | var result = this._super(data, grouped); |
3204 | 101 | if (this.editable()) { | 101 | if (this.editable()) { |
3206 | 102 | this.$element.addClass('oe_list_editable'); | 102 | this.$el.addClass('oe_list_editable'); |
3207 | 103 | // FIXME: any hook available to ensure this is only done once? | 103 | // FIXME: any hook available to ensure this is only done once? |
3208 | 104 | this.$buttons | 104 | this.$buttons |
3209 | 105 | .off('click', '.oe_list_save') | 105 | .off('click', '.oe_list_save') |
3210 | @@ -109,7 +109,7 @@ | |||
3211 | 109 | e.preventDefault(); | 109 | e.preventDefault(); |
3212 | 110 | self.cancel_edition(); | 110 | self.cancel_edition(); |
3213 | 111 | }); | 111 | }); |
3215 | 112 | this.$element | 112 | this.$el |
3216 | 113 | .off('click', 'tbody td:not(.oe_list_field_cell)') | 113 | .off('click', 'tbody td:not(.oe_list_field_cell)') |
3217 | 114 | .on('click', 'tbody td:not(.oe_list_field_cell)', function () { | 114 | .on('click', 'tbody td:not(.oe_list_field_cell)', function () { |
3218 | 115 | if (!self.editor.is_editing()) { | 115 | if (!self.editor.is_editing()) { |
3219 | @@ -120,12 +120,12 @@ | |||
3220 | 120 | // Editor is not restartable due to formview not being | 120 | // Editor is not restartable due to formview not being |
3221 | 121 | // restartable | 121 | // restartable |
3222 | 122 | this.editor = this.make_editor(); | 122 | this.editor = this.make_editor(); |
3224 | 123 | var editor_ready = this.editor.prependTo(this.$element) | 123 | var editor_ready = this.editor.prependTo(this.$el) |
3225 | 124 | .then(this.proxy('setup_events')); | 124 | .then(this.proxy('setup_events')); |
3226 | 125 | 125 | ||
3227 | 126 | return $.when(result, editor_ready); | 126 | return $.when(result, editor_ready); |
3228 | 127 | } else { | 127 | } else { |
3230 | 128 | this.$element.removeClass('oe_list_editable'); | 128 | this.$el.removeClass('oe_list_editable'); |
3231 | 129 | } | 129 | } |
3232 | 130 | 130 | ||
3233 | 131 | return result; | 131 | return result; |
3234 | @@ -203,7 +203,7 @@ | |||
3235 | 203 | } | 203 | } |
3236 | 204 | 204 | ||
3237 | 205 | // FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow | 205 | // FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow |
3239 | 206 | field.$element.attr('data-fieldname', field_name); | 206 | field.$el.attr('data-fieldname', field_name); |
3240 | 207 | self.fields_for_resize.push({field: field, cell: cell}); | 207 | self.fields_for_resize.push({field: field, cell: cell}); |
3241 | 208 | }, options).pipe(function () { | 208 | }, options).pipe(function () { |
3242 | 209 | $recordRow.addClass('oe_edition'); | 209 | $recordRow.addClass('oe_edition'); |
3243 | @@ -249,8 +249,8 @@ | |||
3244 | 249 | var position = $cell.position(); | 249 | var position = $cell.position(); |
3245 | 250 | 250 | ||
3246 | 251 | // jquery does not understand !important | 251 | // jquery does not understand !important |
3249 | 252 | field.$element.attr('style', 'width: '+$cell.outerWidth()+'px !important') | 252 | field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important') |
3250 | 253 | field.$element.css({ | 253 | field.$el.css({ |
3251 | 254 | top: position.top, | 254 | top: position.top, |
3252 | 255 | left: position.left, | 255 | left: position.left, |
3253 | 256 | minHeight: $cell.outerHeight() | 256 | minHeight: $cell.outerHeight() |
3254 | @@ -391,7 +391,7 @@ | |||
3255 | 391 | }, | 391 | }, |
3256 | 392 | setup_events: function () { | 392 | setup_events: function () { |
3257 | 393 | var self = this; | 393 | var self = this; |
3259 | 394 | this.editor.$element.on('keyup keydown', function (e) { | 394 | this.editor.$el.on('keyup keydown', function (e) { |
3260 | 395 | if (!self.editor.is_editing()) { return; } | 395 | if (!self.editor.is_editing()) { return; } |
3261 | 396 | var key = _($.ui.keyCode).chain() | 396 | var key = _($.ui.keyCode).chain() |
3262 | 397 | .map(function (v, k) { return {name: k, code: v}; }) | 397 | .map(function (v, k) { return {name: k, code: v}; }) |
3263 | @@ -540,7 +540,7 @@ | |||
3264 | 540 | if (--field_index < 0) { return $.when(); } | 540 | if (--field_index < 0) { return $.when(); } |
3265 | 541 | 541 | ||
3266 | 542 | field = fields[fields_order[field_index]]; | 542 | field = fields[fields_order[field_index]]; |
3268 | 543 | } while (!field.$element.is(':visible')); | 543 | } while (!field.$el.is(':visible')); |
3269 | 544 | 544 | ||
3270 | 545 | // and focus it | 545 | // and focus it |
3271 | 546 | field.focus(); | 546 | field.focus(); |
3272 | @@ -563,7 +563,7 @@ | |||
3273 | 563 | if (++field_index >= fields_order.length) { return $.when(); } | 563 | if (++field_index >= fields_order.length) { return $.when(); } |
3274 | 564 | 564 | ||
3275 | 565 | field = fields[fields_order[field_index]]; | 565 | field = fields[fields_order[field_index]]; |
3277 | 566 | } while (!field.$element.is(':visible')); | 566 | } while (!field.$el.is(':visible')); |
3278 | 567 | 567 | ||
3279 | 568 | field.focus(); | 568 | field.focus(); |
3280 | 569 | return $.when(); | 569 | return $.when(); |
3281 | @@ -572,11 +572,11 @@ | |||
3282 | 572 | var form = this.editor.form; | 572 | var form = this.editor.form; |
3283 | 573 | var last_field = _(form.fields_order).chain() | 573 | var last_field = _(form.fields_order).chain() |
3284 | 574 | .map(function (name) { return form.fields[name]; }) | 574 | .map(function (name) { return form.fields[name]; }) |
3286 | 575 | .filter(function (field) { return field.$element.is(':visible'); }) | 575 | .filter(function (field) { return field.$el.is(':visible'); }) |
3287 | 576 | .last() | 576 | .last() |
3288 | 577 | .value(); | 577 | .value(); |
3289 | 578 | // tabbed from last field in form | 578 | // tabbed from last field in form |
3291 | 579 | if (last_field && last_field.$element.has(e.target).length) { | 579 | if (last_field && last_field.$el.has(e.target).length) { |
3292 | 580 | e.preventDefault(); | 580 | e.preventDefault(); |
3293 | 581 | return this._next(); | 581 | return this._next(); |
3294 | 582 | } | 582 | } |
3295 | @@ -620,7 +620,7 @@ | |||
3296 | 620 | var _super = this._super(); | 620 | var _super = this._super(); |
3297 | 621 | this.form.embedded_view = this._validate_view( | 621 | this.form.embedded_view = this._validate_view( |
3298 | 622 | this.delegate.edition_view(this)); | 622 | this.delegate.edition_view(this)); |
3300 | 623 | var form_ready = this.form.appendTo(this.$element).then( | 623 | var form_ready = this.form.appendTo(this.$el).then( |
3301 | 624 | self.form.proxy('do_hide')); | 624 | self.form.proxy('do_hide')); |
3302 | 625 | return $.when(_super, form_ready); | 625 | return $.when(_super, form_ready); |
3303 | 626 | }, | 626 | }, |
3304 | @@ -678,7 +678,7 @@ | |||
3305 | 678 | // Is actually in the form | 678 | // Is actually in the form |
3306 | 679 | && (field = form.fields[focus_field]) | 679 | && (field = form.fields[focus_field]) |
3307 | 680 | // And is visible | 680 | // And is visible |
3309 | 681 | && field.$element.is(':visible')) { | 681 | && field.$el.is(':visible')) { |
3310 | 682 | // focus it | 682 | // focus it |
3311 | 683 | field.focus(); | 683 | field.focus(); |
3312 | 684 | return; | 684 | return; |
3313 | @@ -687,7 +687,7 @@ | |||
3314 | 687 | _(form.fields_order).detect(function (name) { | 687 | _(form.fields_order).detect(function (name) { |
3315 | 688 | // look for first visible field in fields_order, focus it | 688 | // look for first visible field in fields_order, focus it |
3316 | 689 | var field = form.fields[name]; | 689 | var field = form.fields[name]; |
3318 | 690 | if (!field.$element.is(':visible')) { | 690 | if (!field.$el.is(':visible')) { |
3319 | 691 | return false; | 691 | return false; |
3320 | 692 | } | 692 | } |
3321 | 693 | // Stop as soon as a field got focused | 693 | // Stop as soon as a field got focused |
3322 | 694 | 694 | ||
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 | 84 | }); | 84 | }); |
3328 | 85 | this.fields = fields_view.fields; | 85 | this.fields = fields_view.fields; |
3329 | 86 | this.hook_row_click(); | 86 | this.hook_row_click(); |
3331 | 87 | this.$element.html(QWeb.render('TreeView', { | 87 | this.$el.html(QWeb.render('TreeView', { |
3332 | 88 | 'title': this.fields_view.arch.attrs.string, | 88 | 'title': this.fields_view.arch.attrs.string, |
3333 | 89 | 'fields_view': this.fields_view.arch.children, | 89 | 'fields_view': this.fields_view.arch.children, |
3334 | 90 | 'fields': this.fields, | 90 | 'fields': this.fields, |
3335 | 91 | 'toolbar': has_toolbar | 91 | 'toolbar': has_toolbar |
3336 | 92 | })); | 92 | })); |
3338 | 93 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 93 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
3339 | 94 | 94 | ||
3340 | 95 | this.dataset.read_slice(this.fields_list()).then(function(records) { | 95 | this.dataset.read_slice(this.fields_list()).then(function(records) { |
3341 | 96 | self.store_record(records); | 96 | self.store_record(records); |
3342 | @@ -102,7 +102,7 @@ | |||
3343 | 102 | return; | 102 | return; |
3344 | 103 | } | 103 | } |
3345 | 104 | 104 | ||
3347 | 105 | var $select = self.$element.find('select') | 105 | var $select = self.$el.find('select') |
3348 | 106 | .change(function () { | 106 | .change(function () { |
3349 | 107 | var $option = $(this).find(':selected'); | 107 | var $option = $(this).find(':selected'); |
3350 | 108 | self.getdata($option.val()); | 108 | self.getdata($option.val()); |
3351 | @@ -120,10 +120,10 @@ | |||
3352 | 120 | $select.change(); | 120 | $select.change(); |
3353 | 121 | } | 121 | } |
3354 | 122 | }); | 122 | }); |
3356 | 123 | this.$element.find("#tree_view_expand").click(function(){ | 123 | this.$el.find("#tree_view_expand").click(function(){ |
3357 | 124 | self.expand_all(); | 124 | self.expand_all(); |
3358 | 125 | }); | 125 | }); |
3360 | 126 | this.$element.find("#tree_view_collapse").click(function(){ | 126 | this.$el.find("#tree_view_collapse").click(function(){ |
3361 | 127 | self.collpase_all(); | 127 | self.collpase_all(); |
3362 | 128 | }); | 128 | }); |
3363 | 129 | // TODO store open nodes in url ?... | 129 | // TODO store open nodes in url ?... |
3364 | @@ -143,14 +143,14 @@ | |||
3365 | 143 | }, | 143 | }, |
3366 | 144 | expand_all: function(){ | 144 | expand_all: function(){ |
3367 | 145 | var self = this; | 145 | var self = this; |
3369 | 146 | var tr = this.$element.find(".oe-treeview-table tbody tr[id^='treerow_']"); | 146 | var tr = this.$el.find(".oe-treeview-table tbody tr[id^='treerow_']"); |
3370 | 147 | _.each(tr,function(rec){ | 147 | _.each(tr,function(rec){ |
3371 | 148 | self.showcontent($(rec).attr('data-id'),true); | 148 | self.showcontent($(rec).attr('data-id'),true); |
3372 | 149 | }); | 149 | }); |
3373 | 150 | }, | 150 | }, |
3374 | 151 | collpase_all: function(){ | 151 | collpase_all: function(){ |
3375 | 152 | var self = this; | 152 | var self = this; |
3377 | 153 | var root_tr = this.$element.find(".oe-treeview-table tbody tr[data-level='"+1+"']"); | 153 | var root_tr = this.$el.find(".oe-treeview-table tbody tr[data-level='"+1+"']"); |
3378 | 154 | _.each(root_tr,function(rec){ | 154 | _.each(root_tr,function(rec){ |
3379 | 155 | if($(rec).hasClass('oe_open')){ | 155 | if($(rec).hasClass('oe_open')){ |
3380 | 156 | self.showcontent($(rec).attr('data-id'),false); | 156 | self.showcontent($(rec).attr('data-id'),false); |
3381 | @@ -187,12 +187,12 @@ | |||
3382 | 187 | */ | 187 | */ |
3383 | 188 | hook_row_click: function () { | 188 | hook_row_click: function () { |
3384 | 189 | var self = this; | 189 | var self = this; |
3386 | 190 | this.$element.delegate('.treeview-td span, .treeview-tr span', 'click', function (e) { | 190 | this.$el.delegate('.treeview-td span, .treeview-tr span', 'click', function (e) { |
3387 | 191 | e.stopImmediatePropagation(); | 191 | e.stopImmediatePropagation(); |
3388 | 192 | self.activate($(this).closest('tr').data('id')); | 192 | self.activate($(this).closest('tr').data('id')); |
3389 | 193 | }); | 193 | }); |
3390 | 194 | 194 | ||
3392 | 195 | this.$element.delegate('.treeview-tr', 'click', function () { | 195 | this.$el.delegate('.treeview-tr', 'click', function () { |
3393 | 196 | var $this = $(this), | 196 | var $this = $(this), |
3394 | 197 | record_id = $this.data('id'), | 197 | record_id = $this.data('id'), |
3395 | 198 | bool = $this.parent().hasClass('oe_open'); | 198 | bool = $this.parent().hasClass('oe_open'); |
3396 | @@ -220,7 +220,7 @@ | |||
3397 | 220 | render_data: function(groupby){ | 220 | render_data: function(groupby){ |
3398 | 221 | var self = this; | 221 | var self = this; |
3399 | 222 | _.each(_.keys(groupby),function(key){ | 222 | _.each(_.keys(groupby),function(key){ |
3401 | 223 | var $curr_node = self.$element.find('#treerow_' + key); | 223 | var $curr_node = self.$el.find('#treerow_' + key); |
3402 | 224 | var record = groupby[key]; | 224 | var record = groupby[key]; |
3403 | 225 | var children_rows = QWeb.render('TreeView.rows', { | 225 | var children_rows = QWeb.render('TreeView.rows', { |
3404 | 226 | 'records': record, | 226 | 'records': record, |
3405 | @@ -235,7 +235,7 @@ | |||
3406 | 235 | $curr_node.addClass('oe_open'); | 235 | $curr_node.addClass('oe_open'); |
3407 | 236 | $curr_node.after(children_rows); | 236 | $curr_node.after(children_rows); |
3408 | 237 | } else { | 237 | } else { |
3410 | 238 | self.$element.find('tbody').html(children_rows); | 238 | self.$el.find('tbody').html(children_rows); |
3411 | 239 | } | 239 | } |
3412 | 240 | }); | 240 | }); |
3413 | 241 | self.collpase_all(); | 241 | self.collpase_all(); |
3414 | @@ -272,11 +272,11 @@ | |||
3415 | 272 | 272 | ||
3416 | 273 | // show & hide the contents | 273 | // show & hide the contents |
3417 | 274 | showcontent: function (record_id, show) { | 274 | showcontent: function (record_id, show) { |
3419 | 275 | this.$element.find('#treerow_' + record_id) | 275 | this.$el.find('#treerow_' + record_id) |
3420 | 276 | .toggleClass('oe_open', show); | 276 | .toggleClass('oe_open', show); |
3421 | 277 | 277 | ||
3422 | 278 | _(this.records[record_id][this.children_field]).each(function (child_id) { | 278 | _(this.records[record_id][this.children_field]).each(function (child_id) { |
3424 | 279 | var $child_row = this.$element.find('#treerow_' + child_id); | 279 | var $child_row = this.$el.find('#treerow_' + child_id); |
3425 | 280 | if ($child_row.hasClass('oe_open')) { | 280 | if ($child_row.hasClass('oe_open')) { |
3426 | 281 | this.showcontent(child_id, false); | 281 | this.showcontent(child_id, false); |
3427 | 282 | } | 282 | } |
3428 | 283 | 283 | ||
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 | 20 | }, | 20 | }, |
3434 | 21 | start: function() { | 21 | start: function() { |
3435 | 22 | this._super.apply(this, arguments); | 22 | this._super.apply(this, arguments); |
3437 | 23 | this.$element.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked); | 23 | this.$el.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked); |
3438 | 24 | }, | 24 | }, |
3439 | 25 | dialog_stop: function () { | 25 | dialog_stop: function () { |
3440 | 26 | if (this.dialog) { | 26 | if (this.dialog) { |
3441 | @@ -53,10 +53,10 @@ | |||
3442 | 53 | } | 53 | } |
3443 | 54 | var item = _.extend({ | 54 | var item = _.extend({ |
3444 | 55 | show: function(index) { | 55 | show: function(index) { |
3446 | 56 | this.widget.$element.show(); | 56 | this.widget.$el.show(); |
3447 | 57 | }, | 57 | }, |
3448 | 58 | hide: function() { | 58 | hide: function() { |
3450 | 59 | this.widget.$element.hide(); | 59 | this.widget.$el.hide(); |
3451 | 60 | }, | 60 | }, |
3452 | 61 | destroy: function() { | 61 | destroy: function() { |
3453 | 62 | this.widget.destroy(); | 62 | this.widget.destroy(); |
3454 | @@ -277,14 +277,14 @@ | |||
3455 | 277 | } | 277 | } |
3456 | 278 | this.dialog.dialog_title = action.name; | 278 | this.dialog.dialog_title = action.name; |
3457 | 279 | this.dialog_widget = widget; | 279 | this.dialog_widget = widget; |
3459 | 280 | this.dialog_widget.appendTo(this.dialog.$element); | 280 | this.dialog_widget.appendTo(this.dialog.$el); |
3460 | 281 | this.dialog.open(); | 281 | this.dialog.open(); |
3461 | 282 | } else { | 282 | } else { |
3462 | 283 | this.dialog_stop(); | 283 | this.dialog_stop(); |
3463 | 284 | this.inner_action = action; | 284 | this.inner_action = action; |
3464 | 285 | this.inner_widget = widget; | 285 | this.inner_widget = widget; |
3465 | 286 | post_process(); | 286 | post_process(); |
3467 | 287 | this.inner_widget.appendTo(this.$element); | 287 | this.inner_widget.appendTo(this.$el); |
3468 | 288 | } | 288 | } |
3469 | 289 | }, | 289 | }, |
3470 | 290 | ir_actions_act_window: function (action, on_close) { | 290 | ir_actions_act_window: function (action, on_close) { |
3471 | @@ -376,7 +376,7 @@ | |||
3472 | 376 | start: function() { | 376 | start: function() { |
3473 | 377 | this._super(); | 377 | this._super(); |
3474 | 378 | var self = this; | 378 | var self = this; |
3476 | 379 | this.$element.find('.oe_view_manager_switch a').click(function() { | 379 | this.$el.find('.oe_view_manager_switch a').click(function() { |
3477 | 380 | self.on_mode_switch($(this).data('view-type')); | 380 | self.on_mode_switch($(this).data('view-type')); |
3478 | 381 | }).tipsy(); | 381 | }).tipsy(); |
3479 | 382 | var views_ids = {}; | 382 | var views_ids = {}; |
3480 | @@ -385,9 +385,9 @@ | |||
3481 | 385 | deferred : $.Deferred(), | 385 | deferred : $.Deferred(), |
3482 | 386 | controller : null, | 386 | controller : null, |
3483 | 387 | options : _.extend({ | 387 | options : _.extend({ |
3487 | 388 | $buttons : self.$element.find('.oe_view_manager_buttons'), | 388 | $buttons : self.$el.find('.oe_view_manager_buttons'), |
3488 | 389 | $sidebar : self.flags.sidebar ? self.$element.find('.oe_view_manager_sidebar') : undefined, | 389 | $sidebar : self.flags.sidebar ? self.$el.find('.oe_view_manager_sidebar') : undefined, |
3489 | 390 | $pager : self.$element.find('.oe_view_manager_pager'), | 390 | $pager : self.$el.find('.oe_view_manager_pager'), |
3490 | 391 | action : self.action, | 391 | action : self.action, |
3491 | 392 | action_views_ids : views_ids | 392 | action_views_ids : views_ids |
3492 | 393 | }, self.flags, self.flags[view.view_type] || {}, view.options || {}) | 393 | }, self.flags, self.flags[view.view_type] || {}, view.options || {}) |
3493 | @@ -395,7 +395,7 @@ | |||
3494 | 395 | views_ids[view.view_type] = view.view_id; | 395 | views_ids[view.view_type] = view.view_id; |
3495 | 396 | }); | 396 | }); |
3496 | 397 | if (this.flags.views_switcher === false) { | 397 | if (this.flags.views_switcher === false) { |
3498 | 398 | this.$element.find('.oe_view_manager_switch').hide(); | 398 | this.$el.find('.oe_view_manager_switch').hide(); |
3499 | 399 | } | 399 | } |
3500 | 400 | // If no default view defined, switch to the first one in sequence | 400 | // If no default view defined, switch to the first one in sequence |
3501 | 401 | var default_view = this.flags.default_view || this.views_src[0].view_type; | 401 | var default_view = this.flags.default_view || this.views_src[0].view_type; |
3502 | @@ -432,9 +432,9 @@ | |||
3503 | 432 | this.searchview[(view.controller.searchable === false || this.searchview.hidden) ? 'hide' : 'show'](); | 432 | this.searchview[(view.controller.searchable === false || this.searchview.hidden) ? 'hide' : 'show'](); |
3504 | 433 | } | 433 | } |
3505 | 434 | 434 | ||
3507 | 435 | this.$element | 435 | this.$el |
3508 | 436 | .find('.oe_view_manager_switch a').parent().removeClass('active'); | 436 | .find('.oe_view_manager_switch a').parent().removeClass('active'); |
3510 | 437 | this.$element | 437 | this.$el |
3511 | 438 | .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]') | 438 | .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]') |
3512 | 439 | .parent().addClass('active'); | 439 | .parent().addClass('active'); |
3513 | 440 | 440 | ||
3514 | @@ -442,7 +442,7 @@ | |||
3515 | 442 | _.each(_.keys(self.views), function(view_name) { | 442 | _.each(_.keys(self.views), function(view_name) { |
3516 | 443 | var controller = self.views[view_name].controller; | 443 | var controller = self.views[view_name].controller; |
3517 | 444 | if (controller) { | 444 | if (controller) { |
3519 | 445 | var container = self.$element.find(".oe_view_manager_view_" + view_name + ":first"); | 445 | var container = self.$el.find(".oe_view_manager_view_" + view_name + ":first"); |
3520 | 446 | if (view_name === view_type) { | 446 | if (view_name === view_type) { |
3521 | 447 | container.show(); | 447 | container.show(); |
3522 | 448 | controller.do_show(view_options || {}); | 448 | controller.do_show(view_options || {}); |
3523 | @@ -451,10 +451,10 @@ | |||
3524 | 451 | controller.do_hide(); | 451 | controller.do_hide(); |
3525 | 452 | } | 452 | } |
3526 | 453 | // put the <footer> in the dialog's buttonpane | 453 | // put the <footer> in the dialog's buttonpane |
3531 | 454 | if (self.$element.parent('.ui-dialog-content') && self.$element.find('footer')) { | 454 | if (self.$el.parent('.ui-dialog-content') && self.$el.find('footer')) { |
3532 | 455 | self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide() | 455 | self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide() |
3533 | 456 | self.$element.find('footer').appendTo( | 456 | self.$el.find('footer').appendTo( |
3534 | 457 | self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane') | 457 | self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane') |
3535 | 458 | ); | 458 | ); |
3536 | 459 | } | 459 | } |
3537 | 460 | } | 460 | } |
3538 | @@ -491,7 +491,7 @@ | |||
3539 | 491 | controller.do_switch_view.add_last(_.bind(this.switch_view, this)); | 491 | controller.do_switch_view.add_last(_.bind(this.switch_view, this)); |
3540 | 492 | 492 | ||
3541 | 493 | controller.do_prev_view.add_last(this.on_prev_view); | 493 | controller.do_prev_view.add_last(this.on_prev_view); |
3543 | 494 | var container = this.$element.find(".oe_view_manager_view_" + view_type); | 494 | var container = this.$el.find(".oe_view_manager_view_" + view_type); |
3544 | 495 | var view_promise = controller.appendTo(container); | 495 | var view_promise = controller.appendTo(container); |
3545 | 496 | this.views[view_type].controller = controller; | 496 | this.views[view_type].controller = controller; |
3546 | 497 | this.views[view_type].deferred.resolve(view_type); | 497 | this.views[view_type].deferred.resolve(view_type); |
3547 | @@ -505,7 +505,7 @@ | |||
3548 | 505 | }); | 505 | }); |
3549 | 506 | }, | 506 | }, |
3550 | 507 | set_title: function(title) { | 507 | set_title: function(title) { |
3552 | 508 | this.$element.find('.oe_view_title_text:first').text(title); | 508 | this.$el.find('.oe_view_title_text:first').text(title); |
3553 | 509 | }, | 509 | }, |
3554 | 510 | add_breadcrumb: function() { | 510 | add_breadcrumb: function() { |
3555 | 511 | var self = this; | 511 | var self = this; |
3556 | @@ -524,7 +524,7 @@ | |||
3557 | 524 | action: this.action, | 524 | action: this.action, |
3558 | 525 | show: function(index) { | 525 | show: function(index) { |
3559 | 526 | var view_to_select = views[index]; | 526 | var view_to_select = views[index]; |
3561 | 527 | self.$element.show(); | 527 | self.$el.show(); |
3562 | 528 | if (self.active_view !== view_to_select) { | 528 | if (self.active_view !== view_to_select) { |
3563 | 529 | self.on_mode_switch(view_to_select); | 529 | self.on_mode_switch(view_to_select); |
3564 | 530 | } | 530 | } |
3565 | @@ -600,7 +600,7 @@ | |||
3566 | 600 | this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false); | 600 | this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false); |
3567 | 601 | 601 | ||
3568 | 602 | this.searchview.on_search.add(this.do_searchview_search); | 602 | this.searchview.on_search.add(this.do_searchview_search); |
3570 | 603 | return this.searchview.appendTo(this.$element.find(".oe_view_manager_view_search")); | 603 | return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search")); |
3571 | 604 | }, | 604 | }, |
3572 | 605 | do_searchview_search: function(domains, contexts, groupbys) { | 605 | do_searchview_search: function(domains, contexts, groupbys) { |
3573 | 606 | var self = this, | 606 | var self = this, |
3574 | @@ -717,8 +717,8 @@ | |||
3575 | 717 | 717 | ||
3576 | 718 | var manager_ready = $.when(searchview_loaded, main_view_loaded); | 718 | var manager_ready = $.when(searchview_loaded, main_view_loaded); |
3577 | 719 | 719 | ||
3580 | 720 | this.$element.find('.oe_debug_view').change(this.on_debug_changed); | 720 | this.$el.find('.oe_debug_view').change(this.on_debug_changed); |
3581 | 721 | this.$element.addClass("oe_view_manager_" + (this.action.target || 'current')); | 721 | this.$el.addClass("oe_view_manager_" + (this.action.target || 'current')); |
3582 | 722 | return manager_ready; | 722 | return manager_ready; |
3583 | 723 | }, | 723 | }, |
3584 | 724 | on_debug_changed: function (evt) { | 724 | on_debug_changed: function (evt) { |
3585 | @@ -730,7 +730,7 @@ | |||
3586 | 730 | switch (val) { | 730 | switch (val) { |
3587 | 731 | case 'fvg': | 731 | case 'fvg': |
3588 | 732 | var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open(); | 732 | var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open(); |
3590 | 733 | $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$element); | 733 | $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$el); |
3591 | 734 | break; | 734 | break; |
3592 | 735 | case 'perm_read': | 735 | case 'perm_read': |
3593 | 736 | var ids = current_view.get_selected_ids(); | 736 | var ids = current_view.get_selected_ids(); |
3594 | @@ -828,7 +828,7 @@ | |||
3595 | 828 | var controller = self.views[self.active_view].controller, | 828 | var controller = self.views[self.active_view].controller, |
3596 | 829 | fvg = controller.fields_view, | 829 | fvg = controller.fields_view, |
3597 | 830 | view_id = (fvg && fvg.view_id) || '--'; | 830 | view_id = (fvg && fvg.view_id) || '--'; |
3599 | 831 | self.$element.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { | 831 | self.$el.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { |
3600 | 832 | view: controller, | 832 | view: controller, |
3601 | 833 | view_manager: self | 833 | view_manager: self |
3602 | 834 | })); | 834 | })); |
3603 | @@ -842,7 +842,7 @@ | |||
3604 | 842 | return r; | 842 | return r; |
3605 | 843 | }, | 843 | }, |
3606 | 844 | set_title: function(title) { | 844 | set_title: function(title) { |
3608 | 845 | this.$element.find('.oe_breadcrumb_title:first').html(this.getParent().get_title()); | 845 | this.$el.find('.oe_breadcrumb_title:first').html(this.getParent().get_title()); |
3609 | 846 | }, | 846 | }, |
3610 | 847 | do_push_state: function(state) { | 847 | do_push_state: function(state) { |
3611 | 848 | if (this.getParent() && this.getParent().do_push_state) { | 848 | if (this.getParent() && this.getParent().do_push_state) { |
3612 | @@ -901,7 +901,7 @@ | |||
3613 | 901 | var self = this; | 901 | var self = this; |
3614 | 902 | this._super(this); | 902 | this._super(this); |
3615 | 903 | this.redraw(); | 903 | this.redraw(); |
3617 | 904 | this.$element.on('click','.oe_dropdown_menu li a', function(event) { | 904 | this.$el.on('click','.oe_dropdown_menu li a', function(event) { |
3618 | 905 | var section = $(this).data('section'); | 905 | var section = $(this).data('section'); |
3619 | 906 | var index = $(this).data('index'); | 906 | var index = $(this).data('index'); |
3620 | 907 | var item = self.items[section][index]; | 907 | var item = self.items[section][index]; |
3621 | @@ -917,7 +917,7 @@ | |||
3622 | 917 | }, | 917 | }, |
3623 | 918 | redraw: function() { | 918 | redraw: function() { |
3624 | 919 | var self = this; | 919 | var self = this; |
3626 | 920 | self.$element.html(QWeb.render('Sidebar', {widget: self})); | 920 | self.$el.html(QWeb.render('Sidebar', {widget: self})); |
3627 | 921 | 921 | ||
3628 | 922 | // Hides Sidebar sections when item list is empty | 922 | // Hides Sidebar sections when item list is empty |
3629 | 923 | this.$('.oe_form_dropdown_section').each(function() { | 923 | this.$('.oe_form_dropdown_section').each(function() { |
3630 | @@ -1024,12 +1024,12 @@ | |||
3631 | 1024 | self.items['files'] = attachments; | 1024 | self.items['files'] = attachments; |
3632 | 1025 | self.redraw(); | 1025 | self.redraw(); |
3633 | 1026 | this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed); | 1026 | this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed); |
3635 | 1027 | this.$element.find('.oe_sidebar_delete_item').click(this.on_attachment_delete); | 1027 | this.$el.find('.oe_sidebar_delete_item').click(this.on_attachment_delete); |
3636 | 1028 | }, | 1028 | }, |
3637 | 1029 | on_attachment_changed: function(e) { | 1029 | on_attachment_changed: function(e) { |
3638 | 1030 | var $e = $(e.target); | 1030 | var $e = $(e.target); |
3639 | 1031 | if ($e.val() !== '') { | 1031 | if ($e.val() !== '') { |
3641 | 1032 | this.$element.find('form.oe_form_binary_form').submit(); | 1032 | this.$el.find('form.oe_form_binary_form').submit(); |
3642 | 1033 | $e.parent().find('input[type=file]').prop('disabled', true); | 1033 | $e.parent().find('input[type=file]').prop('disabled', true); |
3643 | 1034 | $e.parent().find('button').prop('disabled', true).find('img, span').toggle(); | 1034 | $e.parent().find('button').prop('disabled', true).find('img, span').toggle(); |
3644 | 1035 | this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...')); | 1035 | this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...')); |
3645 | @@ -1078,8 +1078,8 @@ | |||
3646 | 1078 | var self = this; | 1078 | var self = this; |
3647 | 1079 | this._super(); | 1079 | this._super(); |
3648 | 1080 | $.when(this.languages_loaded).then(function() { | 1080 | $.when(this.languages_loaded).then(function() { |
3651 | 1081 | self.$element.html(instance.web.qweb.render('TranslateDialog', { widget: self })); | 1081 | self.$el.html(instance.web.qweb.render('TranslateDialog', { widget: self })); |
3652 | 1082 | self.$fields_form = self.$element.find('.oe_translation_form'); | 1082 | self.$fields_form = self.$el.find('.oe_translation_form'); |
3653 | 1083 | self.$fields_form.find('.oe_trad_field').change(function() { | 1083 | self.$fields_form.find('.oe_trad_field').change(function() { |
3654 | 1084 | $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value'))); | 1084 | $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value'))); |
3655 | 1085 | }); | 1085 | }); |
3656 | @@ -1125,8 +1125,8 @@ | |||
3657 | 1125 | if (self.view.translatable_fields && self.view.translatable_fields.length) { | 1125 | if (self.view.translatable_fields && self.view.translatable_fields.length) { |
3658 | 1126 | self.do_load_fields_values(function() { | 1126 | self.do_load_fields_values(function() { |
3659 | 1127 | if (field) { | 1127 | if (field) { |
3662 | 1128 | var $field_input = self.$element.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child'); | 1128 | var $field_input = self.$el.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child'); |
3663 | 1129 | self.$element.scrollTo($field_input); | 1129 | self.$el.scrollTo($field_input); |
3664 | 1130 | $field_input.focus(); | 1130 | $field_input.focus(); |
3665 | 1131 | } | 1131 | } |
3666 | 1132 | }); | 1132 | }); |
3667 | @@ -1302,10 +1302,10 @@ | |||
3668 | 1302 | this.embedded_view = embedded_view; | 1302 | this.embedded_view = embedded_view; |
3669 | 1303 | }, | 1303 | }, |
3670 | 1304 | do_show: function () { | 1304 | do_show: function () { |
3672 | 1305 | this.$element.show(); | 1305 | this.$el.show(); |
3673 | 1306 | }, | 1306 | }, |
3674 | 1307 | do_hide: function () { | 1307 | do_hide: function () { |
3676 | 1308 | this.$element.hide(); | 1308 | this.$el.hide(); |
3677 | 1309 | }, | 1309 | }, |
3678 | 1310 | do_push_state: function(state) { | 1310 | do_push_state: function(state) { |
3679 | 1311 | if (this.getParent() && this.getParent().do_push_state) { | 1311 | if (this.getParent() && this.getParent().do_push_state) { |
3680 | 1312 | 1312 | ||
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 | 1083 | </span> | 1083 | </span> |
3686 | 1084 | </t> | 1084 | </t> |
3687 | 1085 | <t t-name="FieldStatus"> | 1085 | <t t-name="FieldStatus"> |
3689 | 1086 | <ul t-att-class="widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps'" t-att-style="widget.node.attrs.style"/> | 1086 | <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 | 1087 | </t> | 1087 | </t> |
3691 | 1088 | <t t-name="FieldStatus.content"> | 1088 | <t t-name="FieldStatus.content"> |
3692 | 1089 | <t t-foreach="widget.selection" t-as="i"> | 1089 | <t t-foreach="widget.selection" t-as="i"> |
3693 | 1090 | 1090 | ||
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 | 86 | test('no template, default', function () { | 86 | test('no template, default', function () { |
3699 | 87 | var w = new (instance.web.Widget.extend({ })); | 87 | var w = new (instance.web.Widget.extend({ })); |
3700 | 88 | 88 | ||
3702 | 89 | var $original = w.$element; | 89 | var $original = w.$el; |
3703 | 90 | ok($original, "should initially have a root element"); | 90 | ok($original, "should initially have a root element"); |
3704 | 91 | w.renderElement(); | 91 | w.renderElement(); |
3709 | 92 | ok(w.$element, "should have generated a root element"); | 92 | ok(w.$el, "should have generated a root element"); |
3710 | 93 | ok($original !== w.$element, "should have generated a new root element"); | 93 | ok($original !== w.$el, "should have generated a new root element"); |
3711 | 94 | strictEqual(w.$element, w.$element, "should provide $element alias"); | 94 | strictEqual(w.$el, w.$el, "should provide $el alias"); |
3712 | 95 | ok(w.$element.is(w.el), "should provide raw DOM alias"); | 95 | ok(w.$el.is(w.el), "should provide raw DOM alias"); |
3713 | 96 | 96 | ||
3714 | 97 | equal(w.el.nodeName, 'DIV', "should have generated the default element"); | 97 | equal(w.el.nodeName, 'DIV', "should have generated the default element"); |
3715 | 98 | equal(w.el.attributes.length, 0, "should not have generated any attribute"); | 98 | equal(w.el.attributes.length, 0, "should not have generated any attribute"); |
3717 | 99 | ok(_.isEmpty(w.$element.html(), "should not have generated any content")); | 99 | ok(_.isEmpty(w.$el.html(), "should not have generated any content")); |
3718 | 100 | }); | 100 | }); |
3719 | 101 | test('no template, custom tag', function () { | 101 | test('no template, custom tag', function () { |
3720 | 102 | var w = new (instance.web.Widget.extend({ | 102 | var w = new (instance.web.Widget.extend({ |
3721 | @@ -113,7 +113,7 @@ | |||
3722 | 113 | w.renderElement(); | 113 | w.renderElement(); |
3723 | 114 | 114 | ||
3724 | 115 | equal(w.el.attributes.length, 1, "should have one attribute"); | 115 | equal(w.el.attributes.length, 1, "should have one attribute"); |
3726 | 116 | equal(w.$element.attr('id'), 'foo', "should have generated the id attribute"); | 116 | equal(w.$el.attr('id'), 'foo', "should have generated the id attribute"); |
3727 | 117 | equal(w.el.id, 'foo', "should also be available via property"); | 117 | equal(w.el.id, 'foo', "should also be available via property"); |
3728 | 118 | }); | 118 | }); |
3729 | 119 | test('no template, @className', function () { | 119 | test('no template, @className', function () { |
3730 | @@ -123,7 +123,7 @@ | |||
3731 | 123 | w.renderElement(); | 123 | w.renderElement(); |
3732 | 124 | 124 | ||
3733 | 125 | equal(w.el.className, 'oe_some_class', "should have the right property"); | 125 | equal(w.el.className, 'oe_some_class', "should have the right property"); |
3735 | 126 | equal(w.$element.attr('class'), 'oe_some_class', "should have the right attribute"); | 126 | equal(w.$el.attr('class'), 'oe_some_class', "should have the right attribute"); |
3736 | 127 | }); | 127 | }); |
3737 | 128 | test('no template, bunch of attributes', function () { | 128 | test('no template, bunch of attributes', function () { |
3738 | 129 | var w = new (instance.web.Widget.extend({ | 129 | var w = new (instance.web.Widget.extend({ |
3739 | @@ -140,16 +140,16 @@ | |||
3740 | 140 | equal(w.el.attributes.length, 5, "should have all the specified attributes"); | 140 | equal(w.el.attributes.length, 5, "should have all the specified attributes"); |
3741 | 141 | 141 | ||
3742 | 142 | equal(w.el.id, 'some_id'); | 142 | equal(w.el.id, 'some_id'); |
3744 | 143 | equal(w.$element.attr('id'), 'some_id'); | 143 | equal(w.$el.attr('id'), 'some_id'); |
3745 | 144 | 144 | ||
3746 | 145 | equal(w.el.className, 'some_class'); | 145 | equal(w.el.className, 'some_class'); |
3754 | 146 | equal(w.$element.attr('class'), 'some_class'); | 146 | equal(w.$el.attr('class'), 'some_class'); |
3755 | 147 | 147 | ||
3756 | 148 | equal(w.$element.attr('data-foo'), 'data attribute'); | 148 | equal(w.$el.attr('data-foo'), 'data attribute'); |
3757 | 149 | equal(w.$element.data('foo'), 'data attribute'); | 149 | equal(w.$el.data('foo'), 'data attribute'); |
3758 | 150 | 150 | ||
3759 | 151 | equal(w.$element.attr('clark'), 'gable'); | 151 | equal(w.$el.attr('clark'), 'gable'); |
3760 | 152 | equal(w.$element.attr('spoiler'), 'snape kills dumbledore'); | 152 | equal(w.$el.attr('spoiler'), 'snape kills dumbledore'); |
3761 | 153 | }); | 153 | }); |
3762 | 154 | 154 | ||
3763 | 155 | test('template', function () { | 155 | test('template', function () { |
3764 | @@ -159,7 +159,7 @@ | |||
3765 | 159 | w.renderElement(); | 159 | w.renderElement(); |
3766 | 160 | 160 | ||
3767 | 161 | equal(w.el.nodeName, 'OL'); | 161 | equal(w.el.nodeName, 'OL'); |
3769 | 162 | equal(w.$element.children().length, 5); | 162 | equal(w.$el.children().length, 5); |
3770 | 163 | equal(w.el.textContent, '01234'); | 163 | equal(w.el.textContent, '01234'); |
3771 | 164 | }); | 164 | }); |
3772 | 165 | 165 | ||
3773 | @@ -170,7 +170,7 @@ | |||
3774 | 170 | })); | 170 | })); |
3775 | 171 | w.renderElement(); | 171 | w.renderElement(); |
3776 | 172 | 172 | ||
3778 | 173 | ok(w.$('li:eq(3)').is(w.$element.find('li:eq(3)')), | 173 | ok(w.$('li:eq(3)').is(w.$el.find('li:eq(3)')), |
3779 | 174 | "should do the same thing as calling find on the widget root"); | 174 | "should do the same thing as calling find on the widget root"); |
3780 | 175 | }); | 175 | }); |
3781 | 176 | 176 | ||
3782 | @@ -191,7 +191,7 @@ | |||
3783 | 191 | })); | 191 | })); |
3784 | 192 | w.renderElement(); | 192 | w.renderElement(); |
3785 | 193 | 193 | ||
3787 | 194 | w.$element.click(); | 194 | w.$el.click(); |
3788 | 195 | w.$('li:eq(3)').click(); | 195 | w.$('li:eq(3)').click(); |
3789 | 196 | w.$('input:last').val('foo').change(); | 196 | w.$('input:last').val('foo').change(); |
3790 | 197 | 197 | ||
3791 | @@ -206,7 +206,7 @@ | |||
3792 | 206 | events: { 'click li': function () { clicked = true; } } | 206 | events: { 'click li': function () { clicked = true; } } |
3793 | 207 | })); | 207 | })); |
3794 | 208 | w.renderElement(); | 208 | w.renderElement(); |
3796 | 209 | w.$element.on('click', 'li', function () { newclicked = true }); | 209 | w.$el.on('click', 'li', function () { newclicked = true }); |
3797 | 210 | 210 | ||
3798 | 211 | w.$('li').click(); | 211 | w.$('li').click(); |
3799 | 212 | ok(clicked, "should trigger bound events"); | 212 | ok(clicked, "should trigger bound events"); |
3800 | @@ -229,11 +229,11 @@ | |||
3801 | 229 | .always(start) | 229 | .always(start) |
3802 | 230 | .done(function () { | 230 | .done(function () { |
3803 | 231 | equal($fix.find('p').text(), '42', "DOM fixture should contain initial value"); | 231 | equal($fix.find('p').text(), '42', "DOM fixture should contain initial value"); |
3805 | 232 | equal(w.$element.text(), '42', "should set initial value"); | 232 | equal(w.$el.text(), '42', "should set initial value"); |
3806 | 233 | w.value = 36; | 233 | w.value = 36; |
3807 | 234 | w.renderElement(); | 234 | w.renderElement(); |
3808 | 235 | equal($fix.find('p').text(), '36', "DOM fixture should use new value"); | 235 | equal($fix.find('p').text(), '36', "DOM fixture should use new value"); |
3810 | 236 | equal(w.$element.text(), '36', "should set new value"); | 236 | equal(w.$el.text(), '36', "should set new value"); |
3811 | 237 | }); | 237 | }); |
3812 | 238 | }); | 238 | }); |
3813 | 239 | }); | 239 | }); |
3814 | 240 | 240 | ||
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 | 49 | }, | 49 | }, |
3820 | 50 | on_loaded: function(data) { | 50 | on_loaded: function(data) { |
3821 | 51 | this.fields_view = data; | 51 | this.fields_view = data; |
3823 | 52 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 52 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
3824 | 53 | this.calendar_fields = {}; | 53 | this.calendar_fields = {}; |
3825 | 54 | this.ids = this.dataset.ids; | 54 | this.ids = this.dataset.ids; |
3826 | 55 | this.color_values = []; | 55 | this.color_values = []; |
3827 | @@ -104,7 +104,7 @@ | |||
3828 | 104 | 104 | ||
3829 | 105 | if (!this.sidebar && this.options.$sidebar) { | 105 | if (!this.sidebar && this.options.$sidebar) { |
3830 | 106 | this.sidebar = new instance.web_calendar.Sidebar(this); | 106 | this.sidebar = new instance.web_calendar.Sidebar(this); |
3832 | 107 | this.has_been_loaded.pipe(this.sidebar.appendTo(this.$element.find('.oe_calendar_sidebar_container'))); | 107 | this.has_been_loaded.pipe(this.sidebar.appendTo(this.$el.find('.oe_calendar_sidebar_container'))); |
3833 | 108 | } | 108 | } |
3834 | 109 | 109 | ||
3835 | 110 | return this.has_been_loaded.resolve(); | 110 | return this.has_been_loaded.resolve(); |
3836 | @@ -170,10 +170,10 @@ | |||
3837 | 170 | } | 170 | } |
3838 | 171 | }; | 171 | }; |
3839 | 172 | 172 | ||
3841 | 173 | scheduler.init(this.$element.find('.oe_calendar')[0], null, this.mode || 'month'); | 173 | scheduler.init(this.$el.find('.oe_calendar')[0], null, this.mode || 'month'); |
3842 | 174 | 174 | ||
3843 | 175 | // Remove hard coded style attributes from dhtmlx scheduler | 175 | // Remove hard coded style attributes from dhtmlx scheduler |
3845 | 176 | this.$element.find(".dhx_cal_navline div").removeAttr('style'); | 176 | this.$el.find(".dhx_cal_navline div").removeAttr('style'); |
3846 | 177 | 177 | ||
3847 | 178 | scheduler.detachAllEvents(); | 178 | scheduler.detachAllEvents(); |
3848 | 179 | scheduler.attachEvent('onEventAdded', this.do_create_event); | 179 | scheduler.attachEvent('onEventAdded', this.do_create_event); |
3849 | @@ -186,7 +186,7 @@ | |||
3850 | 186 | this.refresh_scheduler(); | 186 | this.refresh_scheduler(); |
3851 | 187 | }, | 187 | }, |
3852 | 188 | on_view_changed: function(mode, date) { | 188 | on_view_changed: function(mode, date) { |
3854 | 189 | this.$element.find('.oe_calendar').removeClass('oe_cal_day oe_cal_week oe_cal_month').addClass('oe_cal_' + mode); | 189 | this.$el.find('.oe_calendar').removeClass('oe_cal_day oe_cal_week oe_cal_month').addClass('oe_cal_' + mode); |
3855 | 190 | if (!date.between(this.range_start, this.range_stop)) { | 190 | if (!date.between(this.range_start, this.range_stop)) { |
3856 | 191 | this.update_range_dates(date); | 191 | this.update_range_dates(date); |
3857 | 192 | this.do_ranged_search(); | 192 | this.do_ranged_search(); |
3858 | @@ -429,7 +429,7 @@ | |||
3859 | 429 | do_show: function () { | 429 | do_show: function () { |
3860 | 430 | var self = this; | 430 | var self = this; |
3861 | 431 | $.when(this.has_been_loaded).then(function() { | 431 | $.when(this.has_been_loaded).then(function() { |
3863 | 432 | self.$element.show(); | 432 | self.$el.show(); |
3864 | 433 | self.do_push_state({}); | 433 | self.do_push_state({}); |
3865 | 434 | }); | 434 | }); |
3866 | 435 | }, | 435 | }, |
3867 | @@ -452,7 +452,7 @@ | |||
3868 | 452 | this.form = new instance.web.FormView(this, this.dataset, this.view_id, { | 452 | this.form = new instance.web.FormView(this, this.dataset, this.view_id, { |
3869 | 453 | pager: false | 453 | pager: false |
3870 | 454 | }); | 454 | }); |
3872 | 455 | var def = this.form.appendTo(this.$element); | 455 | var def = this.form.appendTo(this.$el); |
3873 | 456 | this.form.on_created.add_last(this.on_form_dialog_saved); | 456 | this.form.on_created.add_last(this.on_form_dialog_saved); |
3874 | 457 | this.form.on_saved.add_last(this.on_form_dialog_saved); | 457 | this.form.on_saved.add_last(this.on_form_dialog_saved); |
3875 | 458 | this.form.on_button_cancel = function() { | 458 | this.form.on_button_cancel = function() { |
3876 | @@ -482,7 +482,7 @@ | |||
3877 | 482 | start: function() { | 482 | start: function() { |
3878 | 483 | this._super(); | 483 | this._super(); |
3879 | 484 | this.mini_calendar = scheduler.renderCalendar({ | 484 | this.mini_calendar = scheduler.renderCalendar({ |
3881 | 485 | container: this.$element.find('.oe_calendar_mini')[0], | 485 | container: this.$el.find('.oe_calendar_mini')[0], |
3882 | 486 | navigation: true, | 486 | navigation: true, |
3883 | 487 | date: scheduler._date, | 487 | date: scheduler._date, |
3884 | 488 | handler: function(date, calendar) { | 488 | handler: function(date, calendar) { |
3885 | @@ -490,7 +490,7 @@ | |||
3886 | 490 | } | 490 | } |
3887 | 491 | }); | 491 | }); |
3888 | 492 | this.filter = new instance.web_calendar.SidebarFilter(this, this.getParent()); | 492 | this.filter = new instance.web_calendar.SidebarFilter(this, this.getParent()); |
3890 | 493 | this.filter.appendTo(this.$element.find('.oe_calendar_filter')); | 493 | this.filter.appendTo(this.$el.find('.oe_calendar_filter')); |
3891 | 494 | } | 494 | } |
3892 | 495 | }); | 495 | }); |
3893 | 496 | instance.web_calendar.SidebarFilter = instance.web.Widget.extend({ | 496 | instance.web_calendar.SidebarFilter = instance.web.Widget.extend({ |
3894 | @@ -503,7 +503,7 @@ | |||
3895 | 503 | }, | 503 | }, |
3896 | 504 | on_events_loaded: function(filters) { | 504 | on_events_loaded: function(filters) { |
3897 | 505 | var selected_filters = this.view.selected_filters.slice(0); | 505 | var selected_filters = this.view.selected_filters.slice(0); |
3899 | 506 | this.$element.html(QWeb.render('CalendarView.sidebar.responsible', { filters: filters })); | 506 | this.$el.html(QWeb.render('CalendarView.sidebar.responsible', { filters: filters })); |
3900 | 507 | this.$('div.oe_calendar_responsible input').each(function() { | 507 | this.$('div.oe_calendar_responsible input').each(function() { |
3901 | 508 | if (_.indexOf(selected_filters, $(this).val()) > -1) { | 508 | if (_.indexOf(selected_filters, $(this).val()) > -1) { |
3902 | 509 | $(this).click(); | 509 | $(this).click(); |
3903 | 510 | 510 | ||
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 | 47 | return label.tag == "label"; | 47 | return label.tag == "label"; |
3909 | 48 | }); | 48 | }); |
3910 | 49 | 49 | ||
3913 | 50 | this.$element.html(QWeb.render("DiagramView", this)); | 50 | this.$el.html(QWeb.render("DiagramView", this)); |
3914 | 51 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 51 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
3915 | 52 | 52 | ||
3916 | 53 | _.each(self.labels,function(label){ | 53 | _.each(self.labels,function(label){ |
3917 | 54 | html_label = '<p style="padding: 4px;">' + label.attrs.string + "</p>"; | 54 | html_label = '<p style="padding: 4px;">' + label.attrs.string + "</p>"; |
3919 | 55 | self.$element.find('.oe_diagram_header').append(html_label); | 55 | self.$el.find('.oe_diagram_header').append(html_label); |
3920 | 56 | }) | 56 | }) |
3921 | 57 | 57 | ||
3923 | 58 | this.$element.find('div.oe_diagram_pager button[data-pager-action]').click(function() { | 58 | this.$el.find('div.oe_diagram_pager button[data-pager-action]').click(function() { |
3924 | 59 | var action = $(this).data('pager-action'); | 59 | var action = $(this).data('pager-action'); |
3925 | 60 | self.on_pager_action(action); | 60 | self.on_pager_action(action); |
3926 | 61 | }); | 61 | }); |
3927 | @@ -63,7 +63,7 @@ | |||
3928 | 63 | this.do_update_pager(); | 63 | this.do_update_pager(); |
3929 | 64 | 64 | ||
3930 | 65 | // New Node,Edge | 65 | // New Node,Edge |
3932 | 66 | this.$element.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();}); | 66 | this.$el.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();}); |
3933 | 67 | 67 | ||
3934 | 68 | if(this.id) { | 68 | if(this.id) { |
3935 | 69 | self.get_diagram_info(); | 69 | self.get_diagram_info(); |
3936 | @@ -126,7 +126,7 @@ | |||
3937 | 126 | var res_nodes = result['nodes']; | 126 | var res_nodes = result['nodes']; |
3938 | 127 | var res_edges = result['conn']; | 127 | var res_edges = result['conn']; |
3939 | 128 | this.parent_field = result.parent_field; | 128 | this.parent_field = result.parent_field; |
3941 | 129 | this.$element.find('h3.oe_diagram_title').text(result.name); | 129 | this.$el.find('h3.oe_diagram_title').text(result.name); |
3942 | 130 | 130 | ||
3943 | 131 | var id_to_node = {}; | 131 | var id_to_node = {}; |
3944 | 132 | 132 | ||
3945 | @@ -161,7 +161,7 @@ | |||
3946 | 161 | }; | 161 | }; |
3947 | 162 | 162 | ||
3948 | 163 | // remove previous diagram | 163 | // remove previous diagram |
3950 | 164 | var canvas = self.$element.find('div.oe_diagram_diagram') | 164 | var canvas = self.$el.find('div.oe_diagram_diagram') |
3951 | 165 | .empty().get(0); | 165 | .empty().get(0); |
3952 | 166 | 166 | ||
3953 | 167 | var r = new Raphael(canvas, '100%','100%'); | 167 | var r = new Raphael(canvas, '100%','100%'); |
3954 | @@ -332,7 +332,7 @@ | |||
3955 | 332 | }); | 332 | }); |
3956 | 333 | // We want to destroy the dummy edge after a creation cancel. This destroys it even if we save the changes. | 333 | // We want to destroy the dummy edge after a creation cancel. This destroys it even if we save the changes. |
3957 | 334 | // This is not a problem since the diagram is completely redrawn on saved changes. | 334 | // This is not a problem since the diagram is completely redrawn on saved changes. |
3959 | 335 | pop.$element.bind("dialogbeforeclose",function(){ | 335 | pop.$el.bind("dialogbeforeclose",function(){ |
3960 | 336 | if(dummy_cuteedge){ | 336 | if(dummy_cuteedge){ |
3961 | 337 | dummy_cuteedge.remove(); | 337 | dummy_cuteedge.remove(); |
3962 | 338 | } | 338 | } |
3963 | @@ -370,7 +370,7 @@ | |||
3964 | 370 | }, | 370 | }, |
3965 | 371 | 371 | ||
3966 | 372 | do_update_pager: function(hide_index) { | 372 | do_update_pager: function(hide_index) { |
3968 | 373 | var $pager = this.$element.find('div.oe_diagram_pager'); | 373 | var $pager = this.$el.find('div.oe_diagram_pager'); |
3969 | 374 | var index = hide_index ? '-' : this.dataset.index + 1; | 374 | var index = hide_index ? '-' : this.dataset.index + 1; |
3970 | 375 | if(!this.dataset.count) { | 375 | if(!this.dataset.count) { |
3971 | 376 | this.dataset.count = this.dataset.ids.length; | 376 | this.dataset.count = this.dataset.ids.length; |
3972 | 377 | 377 | ||
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 | 19 | on_loaded: function(fields_view_get, fields_get) { | 19 | on_loaded: function(fields_view_get, fields_get) { |
3978 | 20 | var self = this; | 20 | var self = this; |
3979 | 21 | this.fields_view = fields_view_get; | 21 | this.fields_view = fields_view_get; |
3981 | 22 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 22 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
3982 | 23 | return this.rpc("/web/searchview/fields_get", {"model": this.dataset.model}).pipe(function(fields_get) { | 23 | return this.rpc("/web/searchview/fields_get", {"model": this.dataset.model}).pipe(function(fields_get) { |
3983 | 24 | self.fields = fields_get.fields; | 24 | self.fields = fields_get.fields; |
3984 | 25 | self.has_been_loaded.resolve(); | 25 | self.has_been_loaded.resolve(); |
3985 | @@ -69,7 +69,7 @@ | |||
3986 | 69 | }, | 69 | }, |
3987 | 70 | on_data_loaded_2: function(tasks, group_bys) { | 70 | on_data_loaded_2: function(tasks, group_bys) { |
3988 | 71 | var self = this; | 71 | var self = this; |
3990 | 72 | $(".oe_gantt", this.$element).html(""); | 72 | $(".oe_gantt", this.$el).html(""); |
3991 | 73 | 73 | ||
3992 | 74 | //prevent more that 1 group by | 74 | //prevent more that 1 group by |
3993 | 75 | if (group_bys.length > 0) { | 75 | if (group_bys.length > 0) { |
3994 | @@ -177,7 +177,7 @@ | |||
3995 | 177 | gantt.create(this.chart_id); | 177 | gantt.create(this.chart_id); |
3996 | 178 | 178 | ||
3997 | 179 | // bind event to display task when we click the item in the tree | 179 | // bind event to display task when we click the item in the tree |
3999 | 180 | $(".taskNameItem", self.$element).click(function(event) { | 180 | $(".taskNameItem", self.$el).click(function(event) { |
4000 | 181 | var task_info = task_ids[event.target.id]; | 181 | var task_info = task_ids[event.target.id]; |
4001 | 182 | if (task_info) { | 182 | if (task_info) { |
4002 | 183 | self.on_task_display(task_info.internal_task); | 183 | self.on_task_display(task_info.internal_task); |
4003 | @@ -185,10 +185,10 @@ | |||
4004 | 185 | }); | 185 | }); |
4005 | 186 | 186 | ||
4006 | 187 | // insertion of create button | 187 | // insertion of create button |
4008 | 188 | var td = $($("table td", self.$element)[0]); | 188 | var td = $($("table td", self.$el)[0]); |
4009 | 189 | var rendered = QWeb.render("GanttView-create-button"); | 189 | var rendered = QWeb.render("GanttView-create-button"); |
4010 | 190 | $(rendered).prependTo(td); | 190 | $(rendered).prependTo(td); |
4012 | 191 | $(".oe_gantt_button_create", this.$element).click(this.on_task_create); | 191 | $(".oe_gantt_button_create", this.$el).click(this.on_task_create); |
4013 | 192 | }, | 192 | }, |
4014 | 193 | on_task_changed: function(task_obj) { | 193 | on_task_changed: function(task_obj) { |
4015 | 194 | var self = this; | 194 | var self = this; |
4016 | 195 | 195 | ||
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 | 53 | // TODO: move to load_view and document | 53 | // TODO: move to load_view and document |
4022 | 54 | var self = this; | 54 | var self = this; |
4023 | 55 | this.fields_view = fields_view_get; | 55 | this.fields_view = fields_view_get; |
4025 | 56 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 56 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
4026 | 57 | 57 | ||
4027 | 58 | this.mode = this.fields_view.arch.attrs.type || 'bar'; | 58 | this.mode = this.fields_view.arch.attrs.type || 'bar'; |
4028 | 59 | this.orientation = this.fields_view.arch.attrs.orientation == 'horizontal'; | 59 | this.orientation = this.fields_view.arch.attrs.orientation == 'horizontal'; |
4029 | 60 | 60 | ||
4033 | 61 | var width = this.$element.parent().width(); | 61 | var width = this.$el.parent().width(); |
4034 | 62 | this.$element.css("width", width); | 62 | this.$el.css("width", width); |
4035 | 63 | this.container = this.$element.find("#editor-render-body").css({ | 63 | this.container = this.$el.find("#editor-render-body").css({ |
4036 | 64 | width: width, | 64 | width: width, |
4037 | 65 | height: Math.min(500, width * 0.8) | 65 | height: Math.min(500, width * 0.8) |
4038 | 66 | })[0]; | 66 | })[0]; |
4039 | 67 | 67 | ||
4040 | 68 | var graph_render = this.proxy('graph_render'); | 68 | var graph_render = this.proxy('graph_render'); |
4042 | 69 | this.$element.on('click', '.oe_graph_options a', function (evt) { | 69 | this.$el.on('click', '.oe_graph_options a', function (evt) { |
4043 | 70 | var $el = $(evt.target); | 70 | var $el = $(evt.target); |
4044 | 71 | 71 | ||
4045 | 72 | self.graph_render({data: filter_values({ | 72 | self.graph_render({data: filter_values({ |
4046 | @@ -77,18 +77,18 @@ | |||
4047 | 77 | })}); | 77 | })}); |
4048 | 78 | }); | 78 | }); |
4049 | 79 | 79 | ||
4051 | 80 | this.$element.find("#graph_show_data").click(function () { | 80 | this.$el.find("#graph_show_data").click(function () { |
4052 | 81 | self.spreadsheet = ! self.spreadsheet; | 81 | self.spreadsheet = ! self.spreadsheet; |
4053 | 82 | self.graph_render(); | 82 | self.graph_render(); |
4054 | 83 | }); | 83 | }); |
4056 | 84 | this.$element.find("#graph_switch").click(function () { | 84 | this.$el.find("#graph_switch").click(function () { |
4057 | 85 | if (self.mode != 'radar') { | 85 | if (self.mode != 'radar') { |
4058 | 86 | self.orientation = ! self.orientation; | 86 | self.orientation = ! self.orientation; |
4059 | 87 | } | 87 | } |
4060 | 88 | self.graph_render(); | 88 | self.graph_render(); |
4061 | 89 | }); | 89 | }); |
4062 | 90 | 90 | ||
4064 | 91 | this.$element.find("#graph_download").click(function () { | 91 | this.$el.find("#graph_download").click(function () { |
4065 | 92 | if (self.legend == "top") { self.legend = "inside"; } | 92 | if (self.legend == "top") { self.legend = "inside"; } |
4066 | 93 | self.forcehtml = true; | 93 | self.forcehtml = true; |
4067 | 94 | 94 | ||
4068 | @@ -110,7 +110,7 @@ | |||
4069 | 110 | switch (this.legend) { | 110 | switch (this.legend) { |
4070 | 111 | case 'top': | 111 | case 'top': |
4071 | 112 | legend.noColumns = 4; | 112 | legend.noColumns = 4; |
4073 | 113 | legend.container = this.$element.find("div.graph_header_legend")[0]; | 113 | legend.container = this.$el.find("div.graph_header_legend")[0]; |
4074 | 114 | break; | 114 | break; |
4075 | 115 | case 'inside': | 115 | case 'inside': |
4076 | 116 | legend.position = 'nw'; | 116 | legend.position = 'nw'; |
4077 | @@ -257,24 +257,24 @@ | |||
4078 | 257 | } | 257 | } |
4079 | 258 | 258 | ||
4080 | 259 | // Render the graph | 259 | // Render the graph |
4082 | 260 | this.$element.find(".graph_header_legend").children().remove(); | 260 | this.$el.find(".graph_header_legend").children().remove(); |
4083 | 261 | this.graph = this.make_graph(this.mode, this.container, data); | 261 | this.graph = this.make_graph(this.mode, this.container, data); |
4084 | 262 | 262 | ||
4085 | 263 | // Update styles of menus | 263 | // Update styles of menus |
4086 | 264 | 264 | ||
4088 | 265 | this.$element.find("a").removeClass("active"); | 265 | this.$el.find("a").removeClass("active"); |
4089 | 266 | 266 | ||
4091 | 267 | var $active = this.$element.find('a[data-mode=' + this.mode + ']'); | 267 | var $active = this.$el.find('a[data-mode=' + this.mode + ']'); |
4092 | 268 | if ($active.length > 1) { | 268 | if ($active.length > 1) { |
4093 | 269 | $active = $active.filter('[data-stacked=' + this.stacked + ']'); | 269 | $active = $active.filter('[data-stacked=' + this.stacked + ']'); |
4094 | 270 | } | 270 | } |
4095 | 271 | $active = $active.add( | 271 | $active = $active.add( |
4097 | 272 | this.$element.find('a:not([data-mode])[data-legend=' + this.legend + ']')); | 272 | this.$el.find('a:not([data-mode])[data-legend=' + this.legend + ']')); |
4098 | 273 | 273 | ||
4099 | 274 | $active.addClass('active'); | 274 | $active.addClass('active'); |
4100 | 275 | 275 | ||
4101 | 276 | if (this.spreadsheet) { | 276 | if (this.spreadsheet) { |
4103 | 277 | this.$element.find("#graph_show_data").addClass("active"); | 277 | this.$el.find("#graph_show_data").addClass("active"); |
4104 | 278 | } | 278 | } |
4105 | 279 | return this.graph; | 279 | return this.graph; |
4106 | 280 | }, | 280 | }, |
4107 | 281 | 281 | ||
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 | 1 | <template> | 1 | <template> |
4114 | 2 | <div t-name="GraphView" id="element-chart" class="editor-render" style="position:relative; width: 300px;"> | 2 | <div t-name="GraphView" id="element-chart" class="oe_semantic_html_override editor-render" style="position:relative; width: 300px;"> |
4115 | 3 | <a href="#" class="oe_e dropdown-menu-icon" data-toggle="dropdown" title="Graph Options">&iacute;</a> | 3 | <a href="#" class="oe_e dropdown-menu-icon" data-toggle="dropdown" title="Graph Options">&iacute;</a> |
4116 | 4 | <div class="graph_header_legend"> | 4 | <div class="graph_header_legend"> |
4117 | 5 | </div> | 5 | </div> |
4118 | 6 | 6 | ||
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 | 48 | }, | 48 | }, |
4124 | 49 | on_loaded: function(data) { | 49 | on_loaded: function(data) { |
4125 | 50 | this.fields_view = data; | 50 | this.fields_view = data; |
4127 | 51 | this.$element.addClass(this.fields_view.arch.attrs['class']); | 51 | this.$el.addClass(this.fields_view.arch.attrs['class']); |
4128 | 52 | this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this})); | 52 | this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this})); |
4129 | 53 | if (this.options.$buttons) { | 53 | if (this.options.$buttons) { |
4130 | 54 | this.$buttons.appendTo(this.options.$buttons); | 54 | this.$buttons.appendTo(this.options.$buttons); |
4131 | 55 | } else { | 55 | } else { |
4133 | 56 | this.$element.find('.oe_kanban_buttons').replaceWith(this.$buttons); | 56 | this.$el.find('.oe_kanban_buttons').replaceWith(this.$buttons); |
4134 | 57 | } | 57 | } |
4135 | 58 | this.$buttons | 58 | this.$buttons |
4136 | 59 | .on('click', 'button.oe_kanban_button_new', this.do_add_record) | 59 | .on('click', 'button.oe_kanban_button_new', this.do_add_record) |
4137 | 60 | .on('click', '.oe_kanban_add_column', this.do_add_group); | 60 | .on('click', '.oe_kanban_add_column', this.do_add_group); |
4139 | 61 | this.$groups = this.$element.find('.oe_kanban_groups tr'); | 61 | this.$groups = this.$el.find('.oe_kanban_groups tr'); |
4140 | 62 | this.fields_keys = _.keys(this.fields_view.fields); | 62 | this.fields_keys = _.keys(this.fields_view.fields); |
4141 | 63 | this.add_qweb_template(); | 63 | this.add_qweb_template(); |
4142 | 64 | this.has_been_loaded.resolve(); | 64 | this.has_been_loaded.resolve(); |
4143 | @@ -188,14 +188,14 @@ | |||
4144 | 188 | }; | 188 | }; |
4145 | 189 | var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset); | 189 | var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset); |
4146 | 190 | self.do_add_groups([new_group]).then(function() { | 190 | self.do_add_groups([new_group]).then(function() { |
4148 | 191 | $(window).scrollTo(self.groups.slice(-1)[0].$element, { axis: 'x' }); | 191 | $(window).scrollTo(self.groups.slice(-1)[0].$el, { axis: 'x' }); |
4149 | 192 | }); | 192 | }); |
4150 | 193 | }); | 193 | }); |
4151 | 194 | }); | 194 | }); |
4152 | 195 | }, | 195 | }, |
4153 | 196 | do_search: function(domain, context, group_by) { | 196 | do_search: function(domain, context, group_by) { |
4154 | 197 | var self = this; | 197 | var self = this; |
4156 | 198 | this.$element.find('.oe_view_nocontent').remove(); | 198 | this.$el.find('.oe_view_nocontent').remove(); |
4157 | 199 | this.search_domain = domain; | 199 | this.search_domain = domain; |
4158 | 200 | this.search_context = context; | 200 | this.search_context = context; |
4159 | 201 | this.search_group_by = group_by; | 201 | this.search_group_by = group_by; |
4160 | @@ -204,14 +204,14 @@ | |||
4161 | 204 | self.group_by_field = self.fields_view.fields[self.group_by] || {}; | 204 | self.group_by_field = self.fields_view.fields[self.group_by] || {}; |
4162 | 205 | self.grouped_by_m2o = (self.group_by_field.type === 'many2one'); | 205 | self.grouped_by_m2o = (self.group_by_field.type === 'many2one'); |
4163 | 206 | self.$buttons.find('.oe_alternative').toggle(self.grouped_by_m2o); | 206 | self.$buttons.find('.oe_alternative').toggle(self.grouped_by_m2o); |
4165 | 207 | self.$element.toggleClass('oe_kanban_grouped_by_m2o', self.grouped_by_m2o); | 207 | self.$el.toggleClass('oe_kanban_grouped_by_m2o', self.grouped_by_m2o); |
4166 | 208 | self.datagroup = new instance.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []); | 208 | self.datagroup = new instance.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []); |
4167 | 209 | self.datagroup.list(self.fields_keys, self.do_process_groups, self.do_process_dataset); | 209 | self.datagroup.list(self.fields_keys, self.do_process_groups, self.do_process_dataset); |
4168 | 210 | }); | 210 | }); |
4169 | 211 | }, | 211 | }, |
4170 | 212 | do_process_groups: function(groups) { | 212 | do_process_groups: function(groups) { |
4171 | 213 | var self = this; | 213 | var self = this; |
4173 | 214 | this.$element.remove('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); | 214 | this.$el.remove('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); |
4174 | 215 | this.add_group_mutex.exec(function() { | 215 | this.add_group_mutex.exec(function() { |
4175 | 216 | self.do_clear_groups(); | 216 | self.do_clear_groups(); |
4176 | 217 | self.dataset.ids = []; | 217 | self.dataset.ids = []; |
4177 | @@ -234,7 +234,7 @@ | |||
4178 | 234 | }, | 234 | }, |
4179 | 235 | do_process_dataset: function(dataset) { | 235 | do_process_dataset: function(dataset) { |
4180 | 236 | var self = this; | 236 | var self = this; |
4182 | 237 | this.$element.remove('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); | 237 | this.$el.remove('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); |
4183 | 238 | this.add_group_mutex.exec(function() { | 238 | this.add_group_mutex.exec(function() { |
4184 | 239 | var def = $.Deferred(); | 239 | var def = $.Deferred(); |
4185 | 240 | self.do_clear_groups(); | 240 | self.do_clear_groups(); |
4186 | @@ -268,7 +268,7 @@ | |||
4187 | 268 | }); | 268 | }); |
4188 | 269 | var groups_started = _.map(this.groups, function(group) { | 269 | var groups_started = _.map(this.groups, function(group) { |
4189 | 270 | if (!group.is_started) { | 270 | if (!group.is_started) { |
4191 | 271 | return group.insertBefore(self.$element.find('.oe_kanban_groups_headers td:last')); | 271 | return group.insertBefore(self.$el.find('.oe_kanban_groups_headers td:last')); |
4192 | 272 | } | 272 | } |
4193 | 273 | }); | 273 | }); |
4194 | 274 | return $.when.apply(null, groups_started).then(function () { | 274 | return $.when.apply(null, groups_started).then(function () { |
4195 | @@ -280,7 +280,7 @@ | |||
4196 | 280 | this.compute_groups_width(); | 280 | this.compute_groups_width(); |
4197 | 281 | if (this.group_by) { | 281 | if (this.group_by) { |
4198 | 282 | // Kanban cards drag'n'drop | 282 | // Kanban cards drag'n'drop |
4200 | 283 | this.$element.find('.oe_kanban_column').sortable({ | 283 | this.$el.find('.oe_kanban_column').sortable({ |
4201 | 284 | connectWith: '.oe_kanban_column', | 284 | connectWith: '.oe_kanban_column', |
4202 | 285 | handle : '.oe_kanban_draghandle', | 285 | handle : '.oe_kanban_draghandle', |
4203 | 286 | start: function(event, ui) { | 286 | start: function(event, ui) { |
4204 | @@ -333,13 +333,13 @@ | |||
4205 | 333 | }); | 333 | }); |
4206 | 334 | } | 334 | } |
4207 | 335 | } else { | 335 | } else { |
4209 | 336 | this.$element.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); | 336 | this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); |
4210 | 337 | } | 337 | } |
4211 | 338 | }, | 338 | }, |
4212 | 339 | on_record_moved : function(record, old_group, old_index, new_group, new_index) { | 339 | on_record_moved : function(record, old_group, old_index, new_group, new_index) { |
4213 | 340 | var self = this; | 340 | var self = this; |
4214 | 341 | $.fn.tipsy.clear(); | 341 | $.fn.tipsy.clear(); |
4216 | 342 | $(old_group.$element).add(new_group.$element).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); | 342 | $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); |
4217 | 343 | if (old_group === new_group) { | 343 | if (old_group === new_group) { |
4218 | 344 | new_group.records.splice(old_index, 1); | 344 | new_group.records.splice(old_index, 1); |
4219 | 345 | new_group.records.splice(new_index, 0, record); | 345 | new_group.records.splice(new_index, 0, record); |
4220 | @@ -365,18 +365,18 @@ | |||
4221 | 365 | var self = this; | 365 | var self = this; |
4222 | 366 | _.each(this.groups, function(group) { | 366 | _.each(this.groups, function(group) { |
4223 | 367 | unfolded += group.state.folded ? 0 : 1; | 367 | unfolded += group.state.folded ? 0 : 1; |
4225 | 368 | group.$element.children(':first').css('width', ''); | 368 | group.$el.children(':first').css('width', ''); |
4226 | 369 | }); | 369 | }); |
4227 | 370 | _.each(this.groups, function(group) { | 370 | _.each(this.groups, function(group) { |
4228 | 371 | if (!group.state.folded) { | 371 | if (!group.state.folded) { |
4233 | 372 | if (182*unfolded>=self.$element.width()) { | 372 | if (182*unfolded>=self.$el.width()) { |
4234 | 373 | group.$element.children(':first').css('width', "170px"); | 373 | group.$el.children(':first').css('width', "170px"); |
4235 | 374 | } else if (262*unfolded<self.$element.width()) { | 374 | } else if (262*unfolded<self.$el.width()) { |
4236 | 375 | group.$element.children(':first').css('width', "250px"); | 375 | group.$el.children(':first').css('width', "250px"); |
4237 | 376 | } else { | 376 | } else { |
4238 | 377 | // -12 because of padding 6 between cards | 377 | // -12 because of padding 6 between cards |
4239 | 378 | // -1 because of the border of the latest dummy column | 378 | // -1 because of the border of the latest dummy column |
4241 | 379 | group.$element.children(':first').css('width', Math.floor((self.$element.width()-1)/unfolded)-12 + 'px'); | 379 | group.$el.children(':first').css('width', Math.floor((self.$el.width()-1)/unfolded)-12 + 'px'); |
4242 | 380 | } | 380 | } |
4243 | 381 | } | 381 | } |
4244 | 382 | }); | 382 | }); |
4245 | @@ -408,8 +408,8 @@ | |||
4246 | 408 | || !this.options.action.help) { | 408 | || !this.options.action.help) { |
4247 | 409 | return; | 409 | return; |
4248 | 410 | } | 410 | } |
4251 | 411 | this.$element.find('.oe_view_nocontent').remove(); | 411 | this.$el.find('.oe_view_nocontent').remove(); |
4252 | 412 | this.$element.prepend( | 412 | this.$el.prepend( |
4253 | 413 | $('<div class="oe_view_nocontent">').html(this.options.action.help) | 413 | $('<div class="oe_view_nocontent">').html(this.options.action.help) |
4254 | 414 | ); | 414 | ); |
4255 | 415 | } | 415 | } |
4256 | @@ -471,22 +471,22 @@ | |||
4257 | 471 | var self = this, | 471 | var self = this, |
4258 | 472 | def = this._super(); | 472 | def = this._super(); |
4259 | 473 | if (! self.view.group_by) { | 473 | if (! self.view.group_by) { |
4261 | 474 | self.$element.addClass("oe_kanban_no_group"); | 474 | self.$el.addClass("oe_kanban_no_group"); |
4262 | 475 | self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, {}, false) | 475 | self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, {}, false) |
4263 | 476 | .on('added', self, self.proxy('quick_created')); | 476 | .on('added', self, self.proxy('quick_created')); |
4264 | 477 | self.quick.replace($(".oe_kanban_no_group_qc_placeholder")); | 477 | self.quick.replace($(".oe_kanban_no_group_qc_placeholder")); |
4265 | 478 | } | 478 | } |
4266 | 479 | this.$records = $(QWeb.render('KanbanView.group_records_container', { widget : this})); | 479 | this.$records = $(QWeb.render('KanbanView.group_records_container', { widget : this})); |
4268 | 480 | this.$records.insertBefore(this.view.$element.find('.oe_kanban_groups_records td:last')); | 480 | this.$records.insertBefore(this.view.$el.find('.oe_kanban_groups_records td:last')); |
4269 | 481 | 481 | ||
4271 | 482 | this.$element.on('click', '.oe_kanban_group_dropdown li a', function(ev) { | 482 | this.$el.on('click', '.oe_kanban_group_dropdown li a', function(ev) { |
4272 | 483 | var fn = 'do_action_' + $(ev.target).data().action; | 483 | var fn = 'do_action_' + $(ev.target).data().action; |
4273 | 484 | if (typeof(self[fn]) === 'function') { | 484 | if (typeof(self[fn]) === 'function') { |
4274 | 485 | self[fn]($(ev.target)); | 485 | self[fn]($(ev.target)); |
4275 | 486 | } | 486 | } |
4276 | 487 | }); | 487 | }); |
4277 | 488 | 488 | ||
4279 | 489 | this.$element.find('.oe_kanban_add').click(function () { | 489 | this.$el.find('.oe_kanban_add').click(function () { |
4280 | 490 | if (self.quick) { return; } | 490 | if (self.quick) { return; } |
4281 | 491 | var ctx = {}; | 491 | var ctx = {}; |
4282 | 492 | ctx['default_' + self.view.group_by] = self.value; | 492 | ctx['default_' + self.view.group_by] = self.value; |
4283 | @@ -500,12 +500,12 @@ | |||
4284 | 500 | self.quick.focus(); | 500 | self.quick.focus(); |
4285 | 501 | }); | 501 | }); |
4286 | 502 | // Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column. | 502 | // Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column. |
4288 | 503 | var add_btn = this.$element.find('.oe_kanban_add'); | 503 | var add_btn = this.$el.find('.oe_kanban_add'); |
4289 | 504 | this.$records.find('.oe_kanban_show_more').click(this.do_show_more); | 504 | this.$records.find('.oe_kanban_show_more').click(this.do_show_more); |
4290 | 505 | if (this.state.folded) { | 505 | if (this.state.folded) { |
4291 | 506 | this.do_toggle_fold(); | 506 | this.do_toggle_fold(); |
4292 | 507 | } | 507 | } |
4294 | 508 | this.$element.data('widget', this); | 508 | this.$el.data('widget', this); |
4295 | 509 | this.$records.data('widget', this); | 509 | this.$records.data('widget', this); |
4296 | 510 | this.$has_been_started.resolve(); | 510 | this.$has_been_started.resolve(); |
4297 | 511 | this.compute_cards_auto_height(); | 511 | this.compute_cards_auto_height(); |
4298 | @@ -525,7 +525,7 @@ | |||
4299 | 525 | var min_height = 0; | 525 | var min_height = 0; |
4300 | 526 | var els = []; | 526 | var els = []; |
4301 | 527 | _.each(this.records, function(r) { | 527 | _.each(this.records, function(r) { |
4303 | 528 | var $e = r.$element.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0); | 528 | var $e = r.$el.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0); |
4304 | 529 | if ($e.length) { | 529 | if ($e.length) { |
4305 | 530 | els.push($e[0]); | 530 | els.push($e[0]); |
4306 | 531 | min_height = Math.max(min_height, $e.outerHeight()); | 531 | min_height = Math.max(min_height, $e.outerHeight()); |
4307 | @@ -571,8 +571,8 @@ | |||
4308 | 571 | } | 571 | } |
4309 | 572 | }, | 572 | }, |
4310 | 573 | do_toggle_fold: function(compute_width) { | 573 | do_toggle_fold: function(compute_width) { |
4313 | 574 | this.$element.add(this.$records).toggleClass('oe_kanban_group_folded'); | 574 | this.$el.add(this.$records).toggleClass('oe_kanban_group_folded'); |
4314 | 575 | this.state.folded = this.$element.is('.oe_kanban_group_folded'); | 575 | this.state.folded = this.$el.is('.oe_kanban_group_folded'); |
4315 | 576 | this.$("ul.oe_kanban_group_dropdown li a[data-action=toggle_fold]").text((this.state.folded) ? _t("Unfold") : _t("Fold")); | 576 | this.$("ul.oe_kanban_group_dropdown li a[data-action=toggle_fold]").text((this.state.folded) ? _t("Unfold") : _t("Fold")); |
4316 | 577 | }, | 577 | }, |
4317 | 578 | do_action_toggle_fold: function() { | 578 | do_action_toggle_fold: function() { |
4318 | @@ -658,7 +658,7 @@ | |||
4319 | 658 | }, | 658 | }, |
4320 | 659 | start: function() { | 659 | start: function() { |
4321 | 660 | this._super(); | 660 | this._super(); |
4323 | 661 | this.$element.data('widget', this); | 661 | this.$el.data('widget', this); |
4324 | 662 | this.bind_events(); | 662 | this.bind_events(); |
4325 | 663 | }, | 663 | }, |
4326 | 664 | transform_record: function(record) { | 664 | transform_record: function(record) { |
4327 | @@ -696,14 +696,14 @@ | |||
4328 | 696 | bind_events: function() { | 696 | bind_events: function() { |
4329 | 697 | var self = this; | 697 | var self = this; |
4330 | 698 | this.setup_color_picker(); | 698 | this.setup_color_picker(); |
4332 | 699 | var $show_on_click = self.$element.find('.oe_kanban_box_show_onclick'); | 699 | var $show_on_click = self.$el.find('.oe_kanban_box_show_onclick'); |
4333 | 700 | $show_on_click.toggle(this.state.folded); | 700 | $show_on_click.toggle(this.state.folded); |
4335 | 701 | this.$element.find('.oe_kanban_box_show_onclick_trigger').click(function() { | 701 | this.$el.find('.oe_kanban_box_show_onclick_trigger').click(function() { |
4336 | 702 | $show_on_click.toggle(); | 702 | $show_on_click.toggle(); |
4337 | 703 | self.state.folded = !self.state.folded; | 703 | self.state.folded = !self.state.folded; |
4338 | 704 | }); | 704 | }); |
4339 | 705 | 705 | ||
4341 | 706 | this.$element.find('[tooltip]').tipsy({ | 706 | this.$el.find('[tooltip]').tipsy({ |
4342 | 707 | delayIn: 500, | 707 | delayIn: 500, |
4343 | 708 | delayOut: 0, | 708 | delayOut: 0, |
4344 | 709 | fade: true, | 709 | fade: true, |
4345 | @@ -721,11 +721,11 @@ | |||
4346 | 721 | }); | 721 | }); |
4347 | 722 | 722 | ||
4348 | 723 | // If no draghandle is found, make the whole card as draghandle | 723 | // If no draghandle is found, make the whole card as draghandle |
4351 | 724 | if (!this.$element.find('.oe_kanban_draghandle').length) { | 724 | if (!this.$el.find('.oe_kanban_draghandle').length) { |
4352 | 725 | this.$element.children(':first').addClass('oe_kanban_draghandle'); | 725 | this.$el.children(':first').addClass('oe_kanban_draghandle'); |
4353 | 726 | } | 726 | } |
4354 | 727 | 727 | ||
4356 | 728 | this.$element.find('.oe_kanban_action').click(function() { | 728 | this.$el.find('.oe_kanban_action').click(function() { |
4357 | 729 | var $action = $(this), | 729 | var $action = $(this), |
4358 | 730 | type = $action.data('type') || 'button', | 730 | type = $action.data('type') || 'button', |
4359 | 731 | method = 'do_action_' + (type === 'action' ? 'object' : type); | 731 | method = 'do_action_' + (type === 'action' ? 'object' : type); |
4360 | @@ -738,8 +738,8 @@ | |||
4361 | 738 | } | 738 | } |
4362 | 739 | }); | 739 | }); |
4363 | 740 | 740 | ||
4366 | 741 | if (this.$element.find('.oe_kanban_global_click').length) { | 741 | if (this.$el.find('.oe_kanban_global_click').length) { |
4367 | 742 | this.$element.on('click', function(ev) { | 742 | this.$el.on('click', function(ev) { |
4368 | 743 | if (!ev.isTrigger && !$(ev.target).data('events')) { | 743 | if (!ev.isTrigger && !$(ev.target).data('events')) { |
4369 | 744 | var trigger = true; | 744 | var trigger = true; |
4370 | 745 | var elem = ev.target; | 745 | var elem = ev.target; |
4371 | @@ -784,7 +784,7 @@ | |||
4372 | 784 | }, | 784 | }, |
4373 | 785 | setup_color_picker: function() { | 785 | setup_color_picker: function() { |
4374 | 786 | var self = this; | 786 | var self = this; |
4376 | 787 | var $el = this.$element.find('ul.oe_kanban_colorpicker'); | 787 | var $el = this.$el.find('ul.oe_kanban_colorpicker'); |
4377 | 788 | if ($el.length) { | 788 | if ($el.length) { |
4378 | 789 | $el.html(QWeb.render('KanbanColorPicker', { | 789 | $el.html(QWeb.render('KanbanColorPicker', { |
4379 | 790 | widget: this | 790 | widget: this |
4380 | @@ -829,7 +829,7 @@ | |||
4381 | 829 | if (records.length) { | 829 | if (records.length) { |
4382 | 830 | self.set_record(records[0]); | 830 | self.set_record(records[0]); |
4383 | 831 | self.renderElement(); | 831 | self.renderElement(); |
4385 | 832 | self.$element.data('widget', self); | 832 | self.$el.data('widget', self); |
4386 | 833 | self.bind_events(); | 833 | self.bind_events(); |
4387 | 834 | self.group.compute_cards_auto_height(); | 834 | self.group.compute_cards_auto_height(); |
4388 | 835 | } else { | 835 | } else { |
4389 | @@ -923,16 +923,16 @@ | |||
4390 | 923 | }, | 923 | }, |
4391 | 924 | start: function () { | 924 | start: function () { |
4392 | 925 | var self = this; | 925 | var self = this; |
4394 | 926 | self.$input = this.$element.find('input'); | 926 | self.$input = this.$el.find('input'); |
4395 | 927 | self.$input.keyup(function(event){ | 927 | self.$input.keyup(function(event){ |
4396 | 928 | if(event.keyCode == 13){ | 928 | if(event.keyCode == 13){ |
4397 | 929 | self.quick_add(); | 929 | self.quick_add(); |
4398 | 930 | } | 930 | } |
4399 | 931 | }); | 931 | }); |
4401 | 932 | $(".oe_kanban_quick_create_add", this.$element).click(function () { | 932 | $(".oe_kanban_quick_create_add", this.$el).click(function () { |
4402 | 933 | self.quick_add(); | 933 | self.quick_add(); |
4403 | 934 | }); | 934 | }); |
4405 | 935 | $(".oe_kanban_quick_create_close", this.$element).click(function () { | 935 | $(".oe_kanban_quick_create_close", this.$el).click(function () { |
4406 | 936 | self.trigger('close'); | 936 | self.trigger('close'); |
4407 | 937 | }); | 937 | }); |
4408 | 938 | self.$input.keyup(function(e) { | 938 | self.$input.keyup(function(e) { |
4409 | @@ -942,7 +942,7 @@ | |||
4410 | 942 | }); | 942 | }); |
4411 | 943 | }, | 943 | }, |
4412 | 944 | focus: function() { | 944 | focus: function() { |
4414 | 945 | this.$element.find('input').focus(); | 945 | this.$el.find('input').focus(); |
4415 | 946 | }, | 946 | }, |
4416 | 947 | /** | 947 | /** |
4417 | 948 | * Handles user event from nested quick creation view | 948 | * Handles user event from nested quick creation view |
4418 | 949 | 949 | ||
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 | 28 | <t t-name="KanbanView.group_header"> | 28 | <t t-name="KanbanView.group_header"> |
4424 | 29 | <td class="oe_kanban_group_header"> | 29 | <td class="oe_kanban_group_header"> |
4425 | 30 | <t t-if="widget.view.group_by"> | 30 | <t t-if="widget.view.group_by"> |
4427 | 31 | <div class="oe_kanban_header"> | 31 | <div class="oe_kanban_header oe_semantic_html_override"> |
4428 | 32 | <t t-if="widget.view._is_quick_create_enabled()"> | 32 | <t t-if="widget.view._is_quick_create_enabled()"> |
4429 | 33 | <div class="oe_kanban_add oe_e">]</div> | 33 | <div class="oe_kanban_add oe_e">]</div> |
4430 | 34 | </t> | 34 | </t> |
4431 | 35 | 35 | ||
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 | 51 | var self = this; | 51 | var self = this; |
4437 | 52 | this.session.bind_session().then(function() { | 52 | this.session.bind_session().then(function() { |
4438 | 53 | instance.web.qweb.add_template("xml/web_mobile.xml"); | 53 | instance.web.qweb.add_template("xml/web_mobile.xml"); |
4440 | 54 | self.$element.html(self.render()); | 54 | self.$el.html(self.render()); |
4441 | 55 | self.login.start(); | 55 | self.login.start(); |
4442 | 56 | }); | 56 | }); |
4443 | 57 | } | 57 | } |
4444 | @@ -76,18 +76,18 @@ | |||
4445 | 76 | self.db_list = result.db_list; | 76 | self.db_list = result.db_list; |
4446 | 77 | this.setElement($('#'+self.element_id).html(self.render(self))); | 77 | this.setElement($('#'+self.element_id).html(self.render(self))); |
4447 | 78 | if(self.session.db!=""){ | 78 | if(self.session.db!=""){ |
4449 | 79 | self.$element.find("#database").val(self.session.db); | 79 | self.$el.find("#database").val(self.session.db); |
4450 | 80 | } | 80 | } |
4452 | 81 | self.$element.find("#login_btn").click(self.on_login); | 81 | self.$el.find("#login_btn").click(self.on_login); |
4453 | 82 | $.mobile.initializePage(); | 82 | $.mobile.initializePage(); |
4454 | 83 | }); | 83 | }); |
4456 | 84 | this.$element | 84 | this.$el |
4457 | 85 | .removeClass("login_invalid"); | 85 | .removeClass("login_invalid"); |
4458 | 86 | }, | 86 | }, |
4459 | 87 | on_login: function(ev) { | 87 | on_login: function(ev) { |
4460 | 88 | ev.preventDefault(); | 88 | ev.preventDefault(); |
4461 | 89 | var self = this; | 89 | var self = this; |
4463 | 90 | var $e = this.$element; | 90 | var $e = this.$el; |
4464 | 91 | var db = $e.find("div select[name=database]").val(); | 91 | var db = $e.find("div select[name=database]").val(); |
4465 | 92 | var login = $e.find("div input[name=login]").val(); | 92 | var login = $e.find("div input[name=login]").val(); |
4466 | 93 | var password = $e.find("div input[name=password]").val(); | 93 | var password = $e.find("div input[name=password]").val(); |
4467 | @@ -117,13 +117,13 @@ | |||
4468 | 117 | }); | 117 | }); |
4469 | 118 | }, | 118 | }, |
4470 | 119 | on_login_invalid: function() { | 119 | on_login_invalid: function() { |
4472 | 120 | this.$element | 120 | this.$el |
4473 | 121 | .removeClass("login_valid") | 121 | .removeClass("login_valid") |
4474 | 122 | .addClass("login_invalid") | 122 | .addClass("login_invalid") |
4475 | 123 | .show(); | 123 | .show(); |
4476 | 124 | }, | 124 | }, |
4477 | 125 | on_login_valid: function() { | 125 | on_login_valid: function() { |
4479 | 126 | this.$element | 126 | this.$el |
4480 | 127 | .removeClass("login_invalid") | 127 | .removeClass("login_invalid") |
4481 | 128 | .addClass("login_valid"); | 128 | .addClass("login_valid"); |
4482 | 129 | //.hide(); | 129 | //.hide(); |
4483 | @@ -152,7 +152,7 @@ | |||
4484 | 152 | this._super(session, element_id); | 152 | this._super(session, element_id); |
4485 | 153 | }, | 153 | }, |
4486 | 154 | start: function() { | 154 | start: function() { |
4488 | 155 | this.$element.html(this.render(this)); | 155 | this.$el.html(this.render(this)); |
4489 | 156 | } | 156 | } |
4490 | 157 | }); | 157 | }); |
4491 | 158 | 158 | ||
4492 | @@ -164,7 +164,7 @@ | |||
4493 | 164 | this._super(session, element_id); | 164 | this._super(session, element_id); |
4494 | 165 | }, | 165 | }, |
4495 | 166 | start: function() { | 166 | start: function() { |
4497 | 167 | this.$element.html(this.render(this)); | 167 | this.$el.html(this.render(this)); |
4498 | 168 | } | 168 | } |
4499 | 169 | }); | 169 | }); |
4500 | 170 | 170 | ||
4501 | @@ -178,12 +178,12 @@ | |||
4502 | 178 | start: function() { | 178 | start: function() { |
4503 | 179 | var self = this; | 179 | var self = this; |
4504 | 180 | this.rpc('/web/session/sc_list',{} ,function(res){ | 180 | this.rpc('/web/session/sc_list',{} ,function(res){ |
4508 | 181 | self.$element.html(self.render({'sc': res})); | 181 | self.$el.html(self.render({'sc': res})); |
4509 | 182 | self.$element.find("[data-role=header]").find('h1').html('Favourite'); | 182 | self.$el.find("[data-role=header]").find('h1').html('Favourite'); |
4510 | 183 | self.$element.find("[data-role=header]").find('#home').click(function(){ | 183 | self.$el.find("[data-role=header]").find('#home').click(function(){ |
4511 | 184 | $.mobile.changePage("#oe_menu", "slide", false, true); | 184 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4512 | 185 | }); | 185 | }); |
4514 | 186 | self.$element.find('#content').find("a").click(self.on_clicked); | 186 | self.$el.find('#content').find("a").click(self.on_clicked); |
4515 | 187 | $.mobile.changePage("#oe_shortcuts", "slide", false, true); | 187 | $.mobile.changePage("#oe_shortcuts", "slide", false, true); |
4516 | 188 | }); | 188 | }); |
4517 | 189 | }, | 189 | }, |
4518 | @@ -228,10 +228,10 @@ | |||
4519 | 228 | this.header.start(); | 228 | this.header.start(); |
4520 | 229 | this.footer = new instance.web_mobile.Footer(this, "oe_footer"); | 229 | this.footer = new instance.web_mobile.Footer(this, "oe_footer"); |
4521 | 230 | this.footer.start(); | 230 | this.footer.start(); |
4526 | 231 | this.$element.html(this.render(this.data)); | 231 | this.$el.html(this.render(this.data)); |
4527 | 232 | this.$element.find("[data-role=header]").find('h1').html('Applications'); | 232 | this.$el.find("[data-role=header]").find('h1').html('Applications'); |
4528 | 233 | this.$element.find("[data-role=header]").find('#home').hide(); | 233 | this.$el.find("[data-role=header]").find('#home').hide(); |
4529 | 234 | this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){ | 234 | this.$el.find("[data-role=footer]").find('#shrotcuts').click(function(){ |
4530 | 235 | if(!$('#oe_shortcuts').html().length){ | 235 | if(!$('#oe_shortcuts').html().length){ |
4531 | 236 | this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts"); | 236 | this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts"); |
4532 | 237 | this.shortcuts.start(); | 237 | this.shortcuts.start(); |
4533 | @@ -239,7 +239,7 @@ | |||
4534 | 239 | $.mobile.changePage($("#oe_shortcuts"), "slide", false, true); | 239 | $.mobile.changePage($("#oe_shortcuts"), "slide", false, true); |
4535 | 240 | } | 240 | } |
4536 | 241 | }); | 241 | }); |
4538 | 242 | this.$element.find("[data-role=footer]").find('#preference').click(function(){ | 242 | this.$el.find("[data-role=footer]").find('#preference').click(function(){ |
4539 | 243 | if(!$('#oe_options').html().length){ | 243 | if(!$('#oe_options').html().length){ |
4540 | 244 | this.options = new instance.web_mobile.Options(self, "oe_options"); | 244 | this.options = new instance.web_mobile.Options(self, "oe_options"); |
4541 | 245 | this.options.start(); | 245 | this.options.start(); |
4542 | @@ -247,7 +247,7 @@ | |||
4543 | 247 | $.mobile.changePage("#oe_options", "slide", false, true); | 247 | $.mobile.changePage("#oe_options", "slide", false, true); |
4544 | 248 | } | 248 | } |
4545 | 249 | }); | 249 | }); |
4547 | 250 | this.$element.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click); | 250 | this.$el.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click); |
4548 | 251 | $.mobile.changePage("#oe_menu", "slide", false, true); | 251 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4549 | 252 | }, | 252 | }, |
4550 | 253 | on_menu_click: function(ev, id) { | 253 | on_menu_click: function(ev, id) { |
4551 | @@ -260,7 +260,7 @@ | |||
4552 | 260 | this.children = this.data.data.children[i]; | 260 | this.children = this.data.data.children[i]; |
4553 | 261 | } | 261 | } |
4554 | 262 | } | 262 | } |
4556 | 263 | this.$element | 263 | this.$el |
4557 | 264 | .removeClass("login_valid") | 264 | .removeClass("login_valid") |
4558 | 265 | .addClass("secondary_menu"); | 265 | .addClass("secondary_menu"); |
4559 | 266 | if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ | 266 | if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ |
4560 | @@ -284,10 +284,10 @@ | |||
4561 | 284 | start: function(ev, id) { | 284 | start: function(ev, id) { |
4562 | 285 | var self = this; | 285 | var self = this; |
4563 | 286 | var v = { menu : this.data }; | 286 | var v = { menu : this.data }; |
4568 | 287 | this.$element.html(this.render(v)); | 287 | this.$el.html(this.render(v)); |
4569 | 288 | this.$element.find("[data-role=header]").find("h1").html(this.data.name); | 288 | this.$el.find("[data-role=header]").find("h1").html(this.data.name); |
4570 | 289 | this.$element.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click); | 289 | this.$el.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click); |
4571 | 290 | this.$element.find("[data-role=header]").find('#home').click(function(){ | 290 | this.$el.find("[data-role=header]").find('#home').click(function(){ |
4572 | 291 | $.mobile.changePage("#oe_menu", "slide", false, true); | 291 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4573 | 292 | }); | 292 | }); |
4574 | 293 | $.mobile.changePage("#"+this.element_id, "slide", false, true); | 293 | $.mobile.changePage("#"+this.element_id, "slide", false, true); |
4575 | @@ -308,7 +308,7 @@ | |||
4576 | 308 | } | 308 | } |
4577 | 309 | } | 309 | } |
4578 | 310 | if (child_len > 0) { | 310 | if (child_len > 0) { |
4580 | 311 | this.$element | 311 | this.$el |
4581 | 312 | .addClass("secondary_menu"); | 312 | .addClass("secondary_menu"); |
4582 | 313 | if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ | 313 | if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ |
4583 | 314 | $('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe'); | 314 | $('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe'); |
4584 | @@ -336,12 +336,12 @@ | |||
4585 | 336 | 336 | ||
4586 | 337 | start: function() { | 337 | start: function() { |
4587 | 338 | var self = this; | 338 | var self = this; |
4591 | 339 | this.$element.html(this.render(this)); | 339 | this.$el.html(this.render(this)); |
4592 | 340 | this.$element.find("[data-role=header]").find('h1').html('Preference'); | 340 | this.$el.find("[data-role=header]").find('h1').html('Preference'); |
4593 | 341 | this.$element.find("[data-role=header]").find('#home').click(function(){ | 341 | this.$el.find("[data-role=header]").find('#home').click(function(){ |
4594 | 342 | $.mobile.changePage("#oe_menu", "slide", false, true); | 342 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4595 | 343 | }); | 343 | }); |
4597 | 344 | this.$element.find("[data-role=content]").find('a').click(function(){ | 344 | this.$el.find("[data-role=content]").find('a').click(function(){ |
4598 | 345 | $('#oe_login').empty(); | 345 | $('#oe_login').empty(); |
4599 | 346 | window.location.replace('/mobile'); | 346 | window.location.replace('/mobile'); |
4600 | 347 | }); | 347 | }); |
4601 | 348 | 348 | ||
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 | 48 | } | 48 | } |
4607 | 49 | } | 49 | } |
4608 | 50 | self.hidden_fields(get_fields,fields); | 50 | self.hidden_fields(get_fields,fields); |
4612 | 51 | self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'})); | 51 | self.$el.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'})); |
4613 | 52 | self.$element.find("[data-role=header]").find('h1').html(self.head_title); | 52 | self.$el.find("[data-role=header]").find('h1').html(self.head_title); |
4614 | 53 | self.$element.find("[data-role=header]").find('#home').click(function(){ | 53 | self.$el.find("[data-role=header]").find('#home').click(function(){ |
4615 | 54 | $.mobile.changePage("#oe_menu", "slide", false, true); | 54 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4616 | 55 | }); | 55 | }); |
4618 | 56 | self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){ | 56 | self.$el.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){ |
4619 | 57 | for (var k = 0; k < notebooks.children.length; k++) { | 57 | for (var k = 0; k < notebooks.children.length; k++) { |
4620 | 58 | if (notebooks.children[k].attrs.string == $(this).attr('id')) { | 58 | if (notebooks.children[k].attrs.string == $(this).attr('id')) { |
4621 | 59 | get_fields_notebook = self.get_fields(notebooks.children[k].children); | 59 | get_fields_notebook = self.get_fields(notebooks.children[k].children); |
4622 | @@ -62,7 +62,7 @@ | |||
4623 | 62 | } | 62 | } |
4624 | 63 | } | 63 | } |
4625 | 64 | }); | 64 | }); |
4627 | 65 | self.$element.find('#o2m_m2m').click(function(ev) { | 65 | self.$el.find('#o2m_m2m').click(function(ev) { |
4628 | 66 | ev.preventDefault(); | 66 | ev.preventDefault(); |
4629 | 67 | ev.stopPropagation(); | 67 | ev.stopPropagation(); |
4630 | 68 | var relational = $(this).attr('for'); | 68 | var relational = $(this).attr('for'); |
4631 | @@ -113,7 +113,7 @@ | |||
4632 | 113 | }); | 113 | }); |
4633 | 114 | } | 114 | } |
4634 | 115 | }); | 115 | }); |
4636 | 116 | self.$element.find('#m2o_btn').click(this.open_m2o_form); | 116 | self.$el.find('#m2o_btn').click(this.open_m2o_form); |
4637 | 117 | $.mobile.changePage("#"+self.element_id, "slide", false, true); | 117 | $.mobile.changePage("#"+self.element_id, "slide", false, true); |
4638 | 118 | self.formatdata('', '', '', '',self.element_id,'slider'); | 118 | self.formatdata('', '', '', '',self.element_id,'slider'); |
4639 | 119 | }, | 119 | }, |
4640 | 120 | 120 | ||
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 | 44 | if(res['html_name_get']){ | 44 | if(res['html_name_get']){ |
4646 | 45 | additional = res['display']; | 45 | additional = res['display']; |
4647 | 46 | } | 46 | } |
4651 | 47 | self.$element.html(self.render({'records': res, 'data': additional })); | 47 | self.$el.html(self.render({'records': res, 'data': additional })); |
4652 | 48 | self.$element.find("[data-role=header]").find('h1').html(self.action.name); | 48 | self.$el.find("[data-role=header]").find('h1').html(self.action.name); |
4653 | 49 | self.$element.find("[data-role=header]").find('#home').click(function(){ | 49 | self.$el.find("[data-role=header]").find('#home').click(function(){ |
4654 | 50 | $.mobile.changePage("#oe_menu", "slide", false, true); | 50 | $.mobile.changePage("#oe_menu", "slide", false, true); |
4655 | 51 | }); | 51 | }); |
4657 | 52 | self.$element.find("a#list-id").click(self.on_list_click); | 52 | self.$el.find("a#list-id").click(self.on_list_click); |
4658 | 53 | $.mobile.changePage("#"+self.element_id, "slide", false, true); | 53 | $.mobile.changePage("#"+self.element_id, "slide", false, true); |
4660 | 54 | self.$element.find("a#list-id").find('span').addClass('desc'); | 54 | self.$el.find("a#list-id").find('span').addClass('desc'); |
4661 | 55 | }); | 55 | }); |
4662 | 56 | }); | 56 | }); |
4663 | 57 | }, | 57 | }, |
4664 | 58 | 58 | ||
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 | 1 | { | 1 | { |
4670 | 2 | |||
4671 | 2 | 'name': 'Process', | 3 | 'name': 'Process', |
4672 | 3 | 'version': '2.0', | 4 | 'version': '2.0', |
4673 | 4 | 'description': """ | 5 | 'description': """ |
4674 | @@ -8,7 +9,7 @@ | |||
4675 | 8 | """, | 9 | """, |
4676 | 9 | 'depends': ['web_diagram'], | 10 | 'depends': ['web_diagram'], |
4677 | 10 | 'js': [ | 11 | 'js': [ |
4679 | 11 | 'static/lib/dracula/*.js', | 12 | 'static/lib/js/raphael.js', |
4680 | 12 | 'static/src/js/process.js' | 13 | 'static/src/js/process.js' |
4681 | 13 | ], | 14 | ], |
4682 | 14 | 'css': [ | 15 | 'css': [ |
4683 | 15 | 16 | ||
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 | 1 | /* | ||
4690 | 2 | * Various algorithms and data structures, licensed under the MIT-license. | ||
4691 | 3 | * (c) 2010 by Johann Philipp Strathausen <strathausen@gmail.com> | ||
4692 | 4 | * http://strathausen.eu | ||
4693 | 5 | * | ||
4694 | 6 | */ | ||
4695 | 7 | |||
4696 | 8 | |||
4697 | 9 | |||
4698 | 10 | /* | ||
4699 | 11 | Bellman-Ford | ||
4700 | 12 | |||
4701 | 13 | Path-finding algorithm, finds the shortest paths from one node to all nodes. | ||
4702 | 14 | |||
4703 | 15 | |||
4704 | 16 | Complexity | ||
4705 | 17 | |||
4706 | 18 | O( |E| · |V| ), where E = edges and V = vertices (nodes) | ||
4707 | 19 | |||
4708 | 20 | |||
4709 | 21 | Constraints | ||
4710 | 22 | |||
4711 | 23 | Can run on graphs with negative edge weights as long as they do not have | ||
4712 | 24 | any negative weight cycles. | ||
4713 | 25 | |||
4714 | 26 | */ | ||
4715 | 27 | function bellman_ford(g, source) { | ||
4716 | 28 | |||
4717 | 29 | /* STEP 1: initialisation */ | ||
4718 | 30 | for(var n in g.nodes) | ||
4719 | 31 | g.nodes[n].distance = Infinity; | ||
4720 | 32 | /* predecessors are implicitly null */ | ||
4721 | 33 | source.distance = 0; | ||
4722 | 34 | |||
4723 | 35 | step("Initially, all distances are infinite and all predecessors are null."); | ||
4724 | 36 | |||
4725 | 37 | /* STEP 2: relax each edge (this is at the heart of Bellman-Ford) */ | ||
4726 | 38 | /* repeat this for the number of nodes minus one */ | ||
4727 | 39 | for(var i = 1; i < g.nodes.length; i++) | ||
4728 | 40 | /* for each edge */ | ||
4729 | 41 | for(var e in g.edges) { | ||
4730 | 42 | var edge = g.edges[e]; | ||
4731 | 43 | if(edge.source.distance + edge.weight < edge.target.distance) { | ||
4732 | 44 | step("Relax edge between " + edge.source.id + " and " + edge.target.id + "."); | ||
4733 | 45 | edge.target.distance = edge.source.distance + edge.weight; | ||
4734 | 46 | edge.target.predecessor = edge.source; | ||
4735 | 47 | } | ||
4736 | 48 | //Added by Jake Stothard (Needs to be tested) | ||
4737 | 49 | if(!edge.style.directed) { | ||
4738 | 50 | if(edge.target.distance + edge.weight < edge.source.distance) { | ||
4739 | 51 | g.snapShot("Relax edge between "+edge.target.id+" and "+edge.source.id+"."); | ||
4740 | 52 | edge.source.distance = edge.target.distance + edge.weight; | ||
4741 | 53 | edge.source.predecessor = edge.target; | ||
4742 | 54 | } | ||
4743 | 55 | } | ||
4744 | 56 | } | ||
4745 | 57 | step("Ready."); | ||
4746 | 58 | |||
4747 | 59 | /* STEP 3: TODO Check for negative cycles */ | ||
4748 | 60 | /* For now we assume here that the graph does not contain any negative | ||
4749 | 61 | weights cycles. (this is left as an excercise to the reader[tm]) */ | ||
4750 | 62 | } | ||
4751 | 63 | |||
4752 | 64 | |||
4753 | 65 | |||
4754 | 66 | /* | ||
4755 | 67 | Path-finding algorithm Dijkstra | ||
4756 | 68 | |||
4757 | 69 | - worst-case running time is O((|E| + |V|) · log |V| ) thus better than | ||
4758 | 70 | Bellman-Ford for sparse graphs (with less edges), but cannot handle | ||
4759 | 71 | negative edge weights | ||
4760 | 72 | */ | ||
4761 | 73 | function dijkstra(g, source) { | ||
4762 | 74 | |||
4763 | 75 | /* initially, all distances are infinite and all predecessors are null */ | ||
4764 | 76 | for(var n in g.nodes) | ||
4765 | 77 | g.nodes[n].distance = Infinity; | ||
4766 | 78 | /* predecessors are implicitly null */ | ||
4767 | 79 | |||
4768 | 80 | g.snapShot("Initially, all distances are infinite and all predecessors are null."); | ||
4769 | 81 | |||
4770 | 82 | source.distance = 0; | ||
4771 | 83 | /* set of unoptimized nodes, sorted by their distance (but a Fibonacci heap | ||
4772 | 84 | would be better) */ | ||
4773 | 85 | var q = new BinaryMinHeap(g.nodes, "distance"); | ||
4774 | 86 | |||
4775 | 87 | /* pointer to the node in focus */ | ||
4776 | 88 | var node; | ||
4777 | 89 | |||
4778 | 90 | /* get the node with the smallest distance | ||
4779 | 91 | as long as we have unoptimized nodes. q.min() can have O(log n). */ | ||
4780 | 92 | while(q.min() != undefined) { | ||
4781 | 93 | /* remove the latest */ | ||
4782 | 94 | node = q.extractMin(); | ||
4783 | 95 | node.optimized = true; | ||
4784 | 96 | |||
4785 | 97 | /* no nodes accessible from this one, should not happen */ | ||
4786 | 98 | if(node.distance == Infinity) | ||
4787 | 99 | throw "Orphaned node!"; | ||
4788 | 100 | |||
4789 | 101 | /* for each neighbour of node */ | ||
4790 | 102 | for(e in node.edges) { | ||
4791 | 103 | var other = (node == node.edges[e].target) ? node.edges[e].source : node.edges[e].target; | ||
4792 | 104 | |||
4793 | 105 | if(other.optimized) | ||
4794 | 106 | continue; | ||
4795 | 107 | |||
4796 | 108 | /* look for an alternative route */ | ||
4797 | 109 | var alt = node.distance + node.edges[e].weight; | ||
4798 | 110 | |||
4799 | 111 | /* update distance and route if a better one has been found */ | ||
4800 | 112 | if (alt < other.distance) { | ||
4801 | 113 | |||
4802 | 114 | /* update distance of neighbour */ | ||
4803 | 115 | other.distance = alt; | ||
4804 | 116 | |||
4805 | 117 | /* update priority queue */ | ||
4806 | 118 | q.heapify(); | ||
4807 | 119 | |||
4808 | 120 | /* update path */ | ||
4809 | 121 | other.predecessor = node; | ||
4810 | 122 | g.snapShot("Enhancing node.") | ||
4811 | 123 | } | ||
4812 | 124 | } | ||
4813 | 125 | } | ||
4814 | 126 | } | ||
4815 | 127 | |||
4816 | 128 | |||
4817 | 129 | /* All-Pairs-Shortest-Paths */ | ||
4818 | 130 | /* Runs at worst in O(|V|³) and at best in Omega(|V|³) :-) | ||
4819 | 131 | complexity Sigma(|V|²) */ | ||
4820 | 132 | /* This implementation is not yet ready for general use, but works with the | ||
4821 | 133 | Dracula graph library. */ | ||
4822 | 134 | function floyd_warshall(g, source) { | ||
4823 | 135 | |||
4824 | 136 | /* Step 1: initialising empty path matrix (second dimension is implicit) */ | ||
4825 | 137 | var path = []; | ||
4826 | 138 | var next = []; | ||
4827 | 139 | var n = g.nodes.length; | ||
4828 | 140 | |||
4829 | 141 | /* construct path matrix, initialize with Infinity */ | ||
4830 | 142 | for(j in g.nodes) { | ||
4831 | 143 | path[j] = []; | ||
4832 | 144 | next[j] = []; | ||
4833 | 145 | for(i in g.nodes) | ||
4834 | 146 | path[j][i] = j == i ? 0 : Infinity; | ||
4835 | 147 | } | ||
4836 | 148 | |||
4837 | 149 | /* initialize path with edge weights */ | ||
4838 | 150 | for(e in g.edges) | ||
4839 | 151 | path[g.edges[e].source.id][g.edges[e].target.id] = g.edges[e].weight; | ||
4840 | 152 | |||
4841 | 153 | /* Note: Usually, the initialisation is done by getting the edge weights | ||
4842 | 154 | from a node matrix representation of the graph, not by iterating through | ||
4843 | 155 | a list of edges as done here. */ | ||
4844 | 156 | |||
4845 | 157 | /* Step 2: find best distances (the heart of Floyd-Warshall) */ | ||
4846 | 158 | for(k in g.nodes){ | ||
4847 | 159 | for(i in g.nodes) { | ||
4848 | 160 | for(j in g.nodes) | ||
4849 | 161 | if(path[i][j] > path[i][k] + path[k][j]) { | ||
4850 | 162 | path[i][j] = path[i][k] + path[k][j]; | ||
4851 | 163 | /* Step 2.b: remember the path */ | ||
4852 | 164 | next[i][j] = k; | ||
4853 | 165 | } | ||
4854 | 166 | } | ||
4855 | 167 | } | ||
4856 | 168 | |||
4857 | 169 | /* Step 3: Path reconstruction, get shortest path */ | ||
4858 | 170 | function getPath(i, j) { | ||
4859 | 171 | if(path[i][j] == Infinity) | ||
4860 | 172 | throw "There is no path."; | ||
4861 | 173 | var intermediate = next[i][j]; | ||
4862 | 174 | if(intermediate == undefined) | ||
4863 | 175 | return null; | ||
4864 | 176 | else | ||
4865 | 177 | return getPath(i, intermediate) | ||
4866 | 178 | .concat([intermediate]) | ||
4867 | 179 | .concat(getPath(intermediate, j)); | ||
4868 | 180 | } | ||
4869 | 181 | |||
4870 | 182 | /* TODO use the knowledge, e.g. mark path in graph */ | ||
4871 | 183 | } | ||
4872 | 184 | |||
4873 | 185 | /* | ||
4874 | 186 | Ford-Fulkerson | ||
4875 | 187 | |||
4876 | 188 | Max-Flow-Min-Cut Algorithm finding the maximum flow through a directed | ||
4877 | 189 | graph from source to sink. | ||
4878 | 190 | |||
4879 | 191 | |||
4880 | 192 | Complexity | ||
4881 | 193 | |||
4882 | 194 | O(E * max(f)), max(f) being the maximum flow | ||
4883 | 195 | |||
4884 | 196 | |||
4885 | 197 | Description | ||
4886 | 198 | |||
4887 | 199 | As long as there is an open path through the residual graph, send the | ||
4888 | 200 | minimum of the residual capacities on the path. | ||
4889 | 201 | |||
4890 | 202 | |||
4891 | 203 | Constraints | ||
4892 | 204 | |||
4893 | 205 | The algorithm works only if all weights are integers. Otherwise it is | ||
4894 | 206 | possible that the Ford–Fulkerson algorithm will not converge to the maximum | ||
4895 | 207 | value. | ||
4896 | 208 | |||
4897 | 209 | |||
4898 | 210 | Input | ||
4899 | 211 | |||
4900 | 212 | g - Graph object | ||
4901 | 213 | s - Source ID | ||
4902 | 214 | t - Target (sink) ID | ||
4903 | 215 | |||
4904 | 216 | |||
4905 | 217 | Output | ||
4906 | 218 | |||
4907 | 219 | Maximum flow from Source s to Target t | ||
4908 | 220 | |||
4909 | 221 | */ | ||
4910 | 222 | /* | ||
4911 | 223 | Edmonds-Karp | ||
4912 | 224 | |||
4913 | 225 | Max-Flow-Min-Cut Algorithm finding the maximum flow through a directed | ||
4914 | 226 | graph from source to sink. An implementation of the Ford-Fulkerson | ||
4915 | 227 | algorithm. | ||
4916 | 228 | |||
4917 | 229 | |||
4918 | 230 | Complexity | ||
4919 | 231 | |||
4920 | 232 | O(|V|*|E|²) | ||
4921 | 233 | |||
4922 | 234 | |||
4923 | 235 | Input | ||
4924 | 236 | |||
4925 | 237 | g - Graph object (with node and edge lists, capacity is a property of edge) | ||
4926 | 238 | s - source ID | ||
4927 | 239 | t - sink ID | ||
4928 | 240 | |||
4929 | 241 | */ | ||
4930 | 242 | function edmonds_karp(g, s, t) { | ||
4931 | 243 | |||
4932 | 244 | } | ||
4933 | 245 | |||
4934 | 246 | /* | ||
4935 | 247 | A simple binary min-heap serving as a priority queue | ||
4936 | 248 | - takes an array as the input, with elements having a key property | ||
4937 | 249 | - elements will look like this: | ||
4938 | 250 | { | ||
4939 | 251 | key: "... key property ...", | ||
4940 | 252 | value: "... element content ..." | ||
4941 | 253 | } | ||
4942 | 254 | - provides insert(), min(), extractMin() and heapify() | ||
4943 | 255 | - example usage (e.g. via the Firebug or Chromium console): | ||
4944 | 256 | var x = {foo: 20, hui: "bla"}; | ||
4945 | 257 | var a = new BinaryMinHeap([x,{foo:3},{foo:10},{foo:20},{foo:30},{foo:6},{foo:1},{foo:3}],"foo"); | ||
4946 | 258 | console.log(a.extractMin()); | ||
4947 | 259 | console.log(a.extractMin()); | ||
4948 | 260 | x.foo = 0; // update key | ||
4949 | 261 | a.heapify(); // call this always after having a key updated | ||
4950 | 262 | console.log(a.extractMin()); | ||
4951 | 263 | console.log(a.extractMin()); | ||
4952 | 264 | - can also be used on a simple array, like [9,7,8,5] | ||
4953 | 265 | */ | ||
4954 | 266 | function BinaryMinHeap(array, key) { | ||
4955 | 267 | |||
4956 | 268 | /* Binary tree stored in an array, no need for a complicated data structure */ | ||
4957 | 269 | var tree = []; | ||
4958 | 270 | |||
4959 | 271 | var key = key || 'key'; | ||
4960 | 272 | |||
4961 | 273 | /* Calculate the index of the parent or a child */ | ||
4962 | 274 | var parent = function(index) { return Math.floor((index - 1)/2); }; | ||
4963 | 275 | var right = function(index) { return 2 * index + 2; }; | ||
4964 | 276 | var left = function(index) { return 2 * index + 1; }; | ||
4965 | 277 | |||
4966 | 278 | /* Helper function to swap elements with their parent | ||
4967 | 279 | as long as the parent is bigger */ | ||
4968 | 280 | function bubble_up(i) { | ||
4969 | 281 | var p = parent(i); | ||
4970 | 282 | while((p >= 0) && (tree[i][key] < tree[p][key])) { | ||
4971 | 283 | /* swap with parent */ | ||
4972 | 284 | tree[i] = tree.splice(p, 1, tree[i])[0]; | ||
4973 | 285 | /* go up one level */ | ||
4974 | 286 | i = p; | ||
4975 | 287 | p = parent(i); | ||
4976 | 288 | } | ||
4977 | 289 | } | ||
4978 | 290 | |||
4979 | 291 | /* Helper function to swap elements with the smaller of their children | ||
4980 | 292 | as long as there is one */ | ||
4981 | 293 | function bubble_down(i) { | ||
4982 | 294 | var l = left(i); | ||
4983 | 295 | var r = right(i); | ||
4984 | 296 | |||
4985 | 297 | /* as long as there are smaller children */ | ||
4986 | 298 | while(tree[l] && (tree[i][key] > tree[l][key]) || tree[r] && (tree[i][key] > tree[r][key])) { | ||
4987 | 299 | |||
4988 | 300 | /* find smaller child */ | ||
4989 | 301 | var child = tree[l] ? tree[r] ? tree[l][key] > tree[r][key] ? r : l : l : l; | ||
4990 | 302 | |||
4991 | 303 | /* swap with smaller child with current element */ | ||
4992 | 304 | tree[i] = tree.splice(child, 1, tree[i])[0]; | ||
4993 | 305 | |||
4994 | 306 | /* go up one level */ | ||
4995 | 307 | i = child; | ||
4996 | 308 | l = left(i); | ||
4997 | 309 | r = right(i); | ||
4998 | 310 | } | ||
4999 | 311 | } | ||
5000 | 312 |
The diff has been truncated for viewing.