Merge lp:~openerp-dev/openerp-web/trunk-module-closure-style-msh into lp:openerp-web

Proposed by Mohammed Shekha(Open ERP) on 2014-05-08
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/trunk-module-closure-style-msh
Merge into: lp:openerp-web
Diff against target: 505 lines (+82/-30) (has conflicts)
27 files modified
addons/web/static/src/js/boot.js (+1/-0)
addons/web/static/src/js/chrome.js (+1/-0)
addons/web/static/src/js/core.js (+1/-0)
addons/web/static/src/js/data.js (+1/-0)
addons/web/static/src/js/data_export.js (+1/-0)
addons/web/static/src/js/formats.js (+1/-0)
addons/web/static/src/js/pyeval.js (+1/-0)
addons/web/static/src/js/search.js (+1/-0)
addons/web/static/src/js/test_support.js (+1/-0)
addons/web/static/src/js/testing.js (+2/-0)
addons/web/static/src/js/view_form.js (+1/-0)
addons/web/static/src/js/view_list.js (+2/-0)
addons/web/static/src/js/view_list_editable.js (+1/-0)
addons/web/static/src/js/view_tree.js (+1/-0)
addons/web/static/src/js/views.js (+1/-0)
addons/web/static/src/js/watch.js (+1/-0)
addons/web_calendar/static/src/js/web_calendar.js (+15/-8)
addons/web_diagram/static/src/js/diagram.js (+9/-4)
addons/web_gantt/static/src/js/gantt.js (+6/-2)
addons/web_graph/static/src/js/graph_view.js (+6/-3)
addons/web_graph/static/src/js/graph_widget.js (+1/-1)
addons/web_graph/static/src/js/pivot_table.js (+1/-1)
addons/web_kanban/static/src/js/kanban.js (+8/-1)
addons/web_kanban_gauge/static/src/js/kanban_gauge.js (+4/-2)
addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js (+4/-4)
addons/web_tests/static/src/js/web_tests.js (+4/-2)
addons/web_view_editor/static/src/js/view_editor.js (+6/-2)
Text conflict in addons/web_kanban/static/src/js/kanban.js
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-module-closure-style-msh
Reviewer Review Type Date Requested Status
Fabien Meghazi (OpenERP) 2014-05-08 Pending
Review via email: mp+218761@code.launchpad.net

Description of the change

Hello,

Improved the closure style in all JS backend web modules.

Goal: To convert All javascript backend (webclient) modules into new `closure` style.

Thanks.

To post a comment you must log in.
4011. By Gaurav Panchal (OpenERP) on 2014-05-13

[FIX]Fixed the issue on click while related calendar view

Unmerged revisions

4011. By Gaurav Panchal (OpenERP) on 2014-05-13

[FIX]Fixed the issue on click while related calendar view

4010. By Mohammed Shekha(Open ERP) on 2014-05-07

[MERGE]Merge with trunk branch.

4009. By Mohammed Shekha(Open ERP) on 2014-05-07

[FIX]Fixes issue related to strict mode in calendar, kanban sparkline and listview, issue like Duplicate data property in object literal not allowed in strict mode, variables are not defined, forget to declare it using var, so it becomes globale varibles etc.

4008. By Mohammed Shekha(Open ERP) on 2014-05-07

[IMP]Changed other javascript backend modules using new closure style.

4007. By Mohammed Shekha(Open ERP) on 2014-05-06

[IMP]Improved module to new closure style.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/boot.js'
2--- addons/web/static/src/js/boot.js 2014-05-12 15:18:12 +0000
3+++ addons/web/static/src/js/boot.js 2014-05-13 13:07:32 +0000
4@@ -7,6 +7,7 @@
5 * @namespace openerp
6 */
7 (function() {
8+ "use strict";
9 // copy everything in the openerp namespace to openerp.web
10 openerp.web = _.clone(openerp);
11
12
13=== modified file 'addons/web/static/src/js/chrome.js'
14--- addons/web/static/src/js/chrome.js 2014-05-12 08:10:32 +0000
15+++ addons/web/static/src/js/chrome.js 2014-05-13 13:07:32 +0000
16@@ -2,6 +2,7 @@
17 * OpenERP Web chrome
18 *---------------------------------------------------------*/
19 (function() {
20+"use strict";
21
22 var instance = openerp;
23 openerp.web.chrome = {};
24
25=== modified file 'addons/web/static/src/js/core.js'
26--- addons/web/static/src/js/core.js 2014-05-06 10:36:49 +0000
27+++ addons/web/static/src/js/core.js 2014-05-13 13:07:32 +0000
28@@ -1,5 +1,6 @@
29
30 (function() {
31+"use strict";
32
33 if (typeof(console) === "undefined") {
34 // Even IE9 only exposes console object if debug window opened
35
36=== modified file 'addons/web/static/src/js/data.js'
37--- addons/web/static/src/js/data.js 2014-04-08 09:08:52 +0000
38+++ addons/web/static/src/js/data.js 2014-05-13 13:07:32 +0000
39@@ -1,5 +1,6 @@
40
41 (function() {
42+"use strict";
43
44 var instance = openerp;
45 openerp.web.data = {};
46
47=== modified file 'addons/web/static/src/js/data_export.js'
48--- addons/web/static/src/js/data_export.js 2014-04-30 11:56:50 +0000
49+++ addons/web/static/src/js/data_export.js 2014-05-13 13:07:32 +0000
50@@ -1,5 +1,6 @@
51
52 (function() {
53+"use strict";
54
55 var instance = openerp;
56 openerp.web.data_export = {};
57
58=== modified file 'addons/web/static/src/js/formats.js'
59--- addons/web/static/src/js/formats.js 2014-02-18 16:21:25 +0000
60+++ addons/web/static/src/js/formats.js 2014-05-13 13:07:32 +0000
61@@ -1,5 +1,6 @@
62
63 (function() {
64+"use strict";
65
66 var instance = openerp;
67 openerp.web.formats = {};
68
69=== modified file 'addons/web/static/src/js/pyeval.js'
70--- addons/web/static/src/js/pyeval.js 2014-01-28 13:37:06 +0000
71+++ addons/web/static/src/js/pyeval.js 2014-05-13 13:07:32 +0000
72@@ -2,6 +2,7 @@
73 * py.js helpers and setup
74 */
75 (function() {
76+ "use strict";
77
78 var instance = openerp;
79
80
81=== modified file 'addons/web/static/src/js/search.js'
82--- addons/web/static/src/js/search.js 2014-05-01 17:25:08 +0000
83+++ addons/web/static/src/js/search.js 2014-05-13 13:07:32 +0000
84@@ -1,5 +1,6 @@
85
86 (function() {
87+"use strict";
88
89 var instance = openerp;
90 openerp.web.search = {};
91
92=== modified file 'addons/web/static/src/js/test_support.js'
93--- addons/web/static/src/js/test_support.js 2013-08-06 12:50:22 +0000
94+++ addons/web/static/src/js/test_support.js 2014-05-13 13:07:32 +0000
95@@ -1,4 +1,5 @@
96 (function() {
97+"use strict";
98
99 openerp.test_support = {
100
101
102=== modified file 'addons/web/static/src/js/testing.js'
103--- addons/web/static/src/js/testing.js 2014-04-28 18:24:51 +0000
104+++ addons/web/static/src/js/testing.js 2014-05-13 13:07:32 +0000
105@@ -1,6 +1,8 @@
106 // Test support structures and methods for OpenERP
107 openerp.testing = {};
108 (function (testing) {
109+ "use strict";
110+
111 var dependencies = {
112 pyeval: [],
113 core: ['pyeval'],
114
115=== modified file 'addons/web/static/src/js/view_form.js'
116--- addons/web/static/src/js/view_form.js 2014-05-08 15:34:18 +0000
117+++ addons/web/static/src/js/view_form.js 2014-05-13 13:07:32 +0000
118@@ -1,4 +1,5 @@
119 (function() {
120+"use strict";
121
122 var instance = openerp;
123 var _t = instance.web._t,
124
125=== modified file 'addons/web/static/src/js/view_list.js'
126--- addons/web/static/src/js/view_list.js 2014-05-07 10:45:47 +0000
127+++ addons/web/static/src/js/view_list.js 2014-05-13 13:07:32 +0000
128@@ -1,4 +1,5 @@
129 (function() {
130+"use strict";
131
132 var instance = openerp;
133 openerp.web.list = {};
134@@ -177,6 +178,7 @@
135 var i;
136 var pair;
137 var expression;
138+ var len;
139 if (this.fonts) {
140 for(i=0, len=this.fonts.length; i<len; ++i) {
141 pair = this.fonts[i];
142
143=== modified file 'addons/web/static/src/js/view_list_editable.js'
144--- addons/web/static/src/js/view_list_editable.js 2014-04-09 09:36:16 +0000
145+++ addons/web/static/src/js/view_list_editable.js 2014-05-13 13:07:32 +0000
146@@ -3,6 +3,7 @@
147 * @namespace
148 */
149 (function() {
150+ "use strict";
151
152 var instance = openerp;
153 openerp.web.list_editable = {};
154
155=== modified file 'addons/web/static/src/js/view_tree.js'
156--- addons/web/static/src/js/view_tree.js 2013-09-10 12:52:23 +0000
157+++ addons/web/static/src/js/view_tree.js 2014-05-13 13:07:32 +0000
158@@ -3,6 +3,7 @@
159 *---------------------------------------------------------*/
160
161 (function() {
162+"use strict";
163
164 var instance = openerp;
165 openerp.web.view_tree = {};
166
167=== modified file 'addons/web/static/src/js/views.js'
168--- addons/web/static/src/js/views.js 2014-05-06 12:28:40 +0000
169+++ addons/web/static/src/js/views.js 2014-05-13 13:07:32 +0000
170@@ -3,6 +3,7 @@
171 *---------------------------------------------------------*/
172
173 (function() {
174+"use strict";
175
176 var instance = openerp;
177 openerp.web.views = {};
178
179=== modified file 'addons/web/static/src/js/watch.js'
180--- addons/web/static/src/js/watch.js 2014-04-14 14:58:02 +0000
181+++ addons/web/static/src/js/watch.js 2014-05-13 13:07:32 +0000
182@@ -1,4 +1,5 @@
183 (function() {
184+"use strict";
185 /*
186 * object.watch polyfill
187 *
188
189=== modified file 'addons/web_calendar/static/src/js/web_calendar.js'
190--- addons/web_calendar/static/src/js/web_calendar.js 2014-05-05 15:43:43 +0000
191+++ addons/web_calendar/static/src/js/web_calendar.js 2014-05-13 13:07:32 +0000
192@@ -10,7 +10,10 @@
193 return ret;
194 };
195
196-openerp.web_calendar = function(instance) {
197+(function() {
198+ "use strict";
199+ var instance = openerp;
200+ openerp.web_calendar = {};
201 var _t = instance.web._t,
202 _lt = instance.web._lt,
203 QWeb = instance.web.qweb;
204@@ -20,7 +23,7 @@
205 }
206
207 function get_fc_defaultOptions() {
208- shortTimeformat = Date.CultureInfo.formatPatterns.shortTime;
209+ var shortTimeformat = Date.CultureInfo.formatPatterns.shortTime;
210 return {
211 weekNumberTitle: _t("W"),
212 allDayText: _t("All day"),
213@@ -307,7 +310,7 @@
214 var self = this;
215
216 if (!this.sidebar && this.options.$sidebar) {
217- translate = get_fc_defaultOptions();
218+ var translate = get_fc_defaultOptions();
219 this.sidebar = new instance.web_calendar.Sidebar(this);
220 this.sidebar.appendTo(this.$el.find('.oe_calendar_sidebar_container'));
221
222@@ -507,7 +510,7 @@
223 all_day = this.all_day ? evt[this.all_day] : false,
224 res_computed_text = '',
225 the_title = '',
226- attendees = [];
227+ attendees = [], date_start = null, date_stop = null;
228
229 if (!all_day) {
230 date_start = instance.web.auto_str_to_date(evt[this.date_start]);
231@@ -564,7 +567,7 @@
232 the_title = _.escape(the_title);
233
234
235- the_title_avatar = '';
236+ var the_title_avatar = '';
237
238 if (! _.isUndefined(this.attendee_people)) {
239 var MAX_ATTENDEES = 3;
240@@ -631,7 +634,9 @@
241 * Transform fullcalendar event object to OpenERP Data object
242 */
243 get_event_data: function(event) {
244-
245+ var date_start_day;
246+ var date_stop_day;
247+ var diff_seconds;
248 // Normalize event_end without changing fullcalendars event.
249 var data = {
250 name: event.title
251@@ -794,7 +799,7 @@
252 get_range_domain: function(domain, start, end) {
253 var format = instance.web.date_to_str;
254
255- extend_domain = [[this.date_start, '>=', format(start.clone())],
256+ var extend_domain = [[this.date_start, '>=', format(start.clone())],
257 [this.date_start, '<=', format(end.clone())]];
258
259 if (this.date_stop) {
260@@ -838,6 +843,8 @@
261 },
262 open_event: function(id, title) {
263 var self = this;
264+ var button_delete;
265+ var button_edit;
266 if (! this.open_popup_action) {
267 var index = this.dataset.get_id_index(id);
268 this.dataset.index = index;
269@@ -1436,4 +1443,4 @@
270 },
271 });
272
273-};
274+})();
275
276=== modified file 'addons/web_diagram/static/src/js/diagram.js'
277--- addons/web_diagram/static/src/js/diagram.js 2014-04-30 14:20:25 +0000
278+++ addons/web_diagram/static/src/js/diagram.js 2014-05-13 13:07:32 +0000
279@@ -2,12 +2,17 @@
280 * OpenERP diagram library
281 *---------------------------------------------------------*/
282
283-openerp.web_diagram = function (instance) {
284+(function() {
285+"use strict";
286+
287+var instance = openerp;
288+openerp.web_diagram = {};
289+
290 var QWeb = instance.web.qweb,
291 _t = instance.web._t,
292 _lt = instance.web._lt;
293-instance.web.views.add('diagram', 'instance.web.DiagramView');
294-instance.web.DiagramView = instance.web.View.extend({
295+instance.web.views.add('diagram', 'instance.web_diagram.DiagramView');
296+instance.web_diagram.DiagramView = instance.web.View.extend({
297 display_name: _lt('Diagram'),
298 view_type: 'diagram',
299 searchable: false,
300@@ -429,6 +434,6 @@
301 return $.when(this._super(), this.execute_pager_action('reload'));
302 }
303 });
304-};
305+})();
306
307 // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
308
309=== modified file 'addons/web_gantt/static/src/js/gantt.js'
310--- addons/web_gantt/static/src/js/gantt.js 2014-04-16 10:26:59 +0000
311+++ addons/web_gantt/static/src/js/gantt.js 2014-05-13 13:07:32 +0000
312@@ -1,7 +1,11 @@
313 /*---------------------------------------------------------
314 * OpenERP web_gantt
315 *---------------------------------------------------------*/
316-openerp.web_gantt = function (instance) {
317+(function () {
318+"use strict";
319+
320+var instance = openerp;
321+openerp.web_gantt = {};
322 var _t = instance.web._t,
323 _lt = instance.web._lt;
324 var QWeb = instance.web.qweb;
325@@ -246,4 +250,4 @@
326 },
327 });
328
329-};
330+})();
331
332=== modified file 'addons/web_graph/static/src/js/graph_view.js'
333--- addons/web_graph/static/src/js/graph_view.js 2014-04-22 15:03:16 +0000
334+++ addons/web_graph/static/src/js/graph_view.js 2014-05-13 13:07:32 +0000
335@@ -4,8 +4,11 @@
336
337 /* jshint undef: false */
338
339-openerp.web_graph = function (instance) {
340-'use strict';
341+(function () {
342+"use strict";
343+
344+var instance = openerp;
345+openerp.web_graph = {};
346
347 var _lt = instance.web._lt;
348 var _t = instance.web._t;
349@@ -225,7 +228,7 @@
350 });
351 },
352 });
353-};
354+})();
355
356
357
358
359=== modified file 'addons/web_graph/static/src/js/graph_widget.js'
360--- addons/web_graph/static/src/js/graph_widget.js 2014-05-09 09:09:35 +0000
361+++ addons/web_graph/static/src/js/graph_widget.js 2014-05-13 13:07:32 +0000
362@@ -2,7 +2,7 @@
363 /* jshint undef: false */
364
365 (function () {
366-'use strict';
367+"use strict";
368 var QWeb = openerp.web.qweb;
369 var _lt = openerp.web._lt;
370 var _t = openerp.web._t;
371
372=== modified file 'addons/web_graph/static/src/js/pivot_table.js'
373--- addons/web_graph/static/src/js/pivot_table.js 2014-04-25 10:25:01 +0000
374+++ addons/web_graph/static/src/js/pivot_table.js 2014-05-13 13:07:32 +0000
375@@ -2,7 +2,7 @@
376 /* jshint undef: false */
377
378 (function () {
379-'use strict';
380+"use strict";
381
382 var _lt = openerp.web._lt;
383 var _t = openerp.web._t;
384
385=== modified file 'addons/web_kanban/static/src/js/kanban.js'
386--- addons/web_kanban/static/src/js/kanban.js 2014-05-12 08:10:32 +0000
387+++ addons/web_kanban/static/src/js/kanban.js 2014-05-13 13:07:32 +0000
388@@ -1,5 +1,8 @@
389-openerp.web_kanban = function (instance) {
390+(function () {
391+"use strict";
392
393+var instance = openerp;
394+openerp.web_kanban = {};
395 var _t = instance.web._t,
396 _lt = instance.web._lt;
397 var QWeb = instance.web.qweb;
398@@ -1346,8 +1349,12 @@
399 });
400
401 instance.web_kanban.fields_registry = new instance.web.Registry({});
402+<<<<<<< TREE
403 instance.web_kanban.fields_registry.add('priority','instance.web_kanban.Priority');
404 instance.web_kanban.fields_registry.add('kanban_state_selection','instance.web_kanban.KanbanSelection');
405 };
406+=======
407+})();
408+>>>>>>> MERGE-SOURCE
409
410 // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
411
412=== modified file 'addons/web_kanban_gauge/static/src/js/kanban_gauge.js'
413--- addons/web_kanban_gauge/static/src/js/kanban_gauge.js 2014-02-11 12:26:22 +0000
414+++ addons/web_kanban_gauge/static/src/js/kanban_gauge.js 2014-05-13 13:07:32 +0000
415@@ -1,4 +1,5 @@
416-openerp.web_kanban_gauge = function (instance) {
417+(function () {
418+"use strict";
419
420 /**
421 * Kanban widgets: GaugeWidget
422@@ -17,6 +18,7 @@
423 * - on_click_label: optional label of the input displayed when clicking
424 *
425 */
426+var instance = openerp;
427 var _t = instance.web._t,
428 _lt = instance.web._lt;
429
430@@ -155,4 +157,4 @@
431
432 instance.web_kanban.fields_registry.add("gauge", "instance.web_kanban.GaugeWidget");
433
434-}
435+})();
436
437=== modified file 'addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js'
438--- addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js 2014-04-17 08:59:54 +0000
439+++ addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js 2014-05-13 13:07:32 +0000
440@@ -1,10 +1,11 @@
441-openerp.web_kanban_sparkline = function (instance) {
442-
443+(function () {
444+"use strict";
445 /**
446 * Kanban widgets: Sparkline
447 *
448 */
449
450+var instance = openerp;
451 instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.extend({
452 className: "oe_sparkline_bar",
453 start: function() {
454@@ -17,7 +18,6 @@
455 var tooltipFormat = self.options.type == 'tristate' && '{{offset:offset}}' + suffix || '{{offset:offset}} {{value:value}}' + suffix
456 var sparkline_options = _.extend({
457 type: 'bar',
458- barWidth: 5,
459 height: '20px',
460 barWidth: 4,
461 barSpacing: 1,
462@@ -37,4 +37,4 @@
463 instance.web_kanban.fields_registry.add("sparkline_bar", "instance.web_kanban.SparklineBarWidget");
464
465
466-}
467+})();
468
469=== modified file 'addons/web_tests/static/src/js/web_tests.js'
470--- addons/web_tests/static/src/js/web_tests.js 2012-10-30 14:06:30 +0000
471+++ addons/web_tests/static/src/js/web_tests.js 2014-05-13 13:07:32 +0000
472@@ -1,4 +1,6 @@
473-openerp.web_tests = function (instance) {
474+(function () {
475+ "use strict";
476+ var instance = openerp;
477 instance.web.client_actions.add(
478 'buncha-forms', 'instance.web_tests.BunchaForms');
479 instance.web_tests = {};
480@@ -34,4 +36,4 @@
481 }, this);
482 }
483 });
484-};
485+})();
486
487=== modified file 'addons/web_view_editor/static/src/js/view_editor.js'
488--- addons/web_view_editor/static/src/js/view_editor.js 2014-04-11 12:27:53 +0000
489+++ addons/web_view_editor/static/src/js/view_editor.js 2014-05-13 13:07:32 +0000
490@@ -1,4 +1,8 @@
491-openerp.web_view_editor = function(instance) {
492+(function() {
493+"use strict";
494+
495+var instance = openerp;
496+instance.web_view_editor = {};
497 var _t = instance.web._t;
498 var QWeb = instance.web.qweb;
499 instance.web.ViewManagerAction.include({
500@@ -1227,4 +1231,4 @@
501 'char' : 'instance.web_view_editor.ViewEditor.FieldChar',
502 'float' : 'instance.web_view_editor.ViewEditor.FieldFloat'
503 });
504-};
505+})();