Merge lp:~openerp-dev/openerp-web/6.1-bug-972356-vda into lp:openerp-web/6.1

Proposed by Vaibhav Darji
Status: Merged
Merge reported by: Fabien Meghazi (OpenERP)
Merged at revision: not available
Proposed branch: lp:~openerp-dev/openerp-web/6.1-bug-972356-vda
Merge into: lp:openerp-web/6.1
Diff against target: 44 lines (+8/-17)
1 file modified
addons/web_calendar/static/src/js/calendar.js (+8/-17)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-bug-972356-vda
Reviewer Review Type Date Requested Status
Vaibhav Darji (community) Needs Resubmitting
Review via email: mp+101078@code.launchpad.net

Description of the change

Info fields on Event text.

To post a comment you must log in.
Revision history for this message
Vaibhav Darji (vaibhav-openerp) :
review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web_calendar/static/src/js/calendar.js'
2--- addons/web_calendar/static/src/js/calendar.js 2012-03-28 15:38:25 +0000
3+++ addons/web_calendar/static/src/js/calendar.js 2012-04-06 09:54:20 +0000
4@@ -242,22 +242,14 @@
5 var date_start = openerp.web.str_to_datetime(evt[this.date_start]),
6 date_stop = this.date_stop ? openerp.web.str_to_datetime(evt[this.date_stop]) : null,
7 date_delay = evt[this.date_delay] || 1.0,
8- res_text = '',
9- res_description = [];
10+ res_text = '';
11
12 if (this.info_fields) {
13- var fld = evt[this.info_fields[0]];
14- res_text = (typeof fld == 'object') ? fld[fld.length -1] : res_text = fld;
15-
16- var sliced_info_fields = this.info_fields.slice(1);
17- for (var sl_fld in sliced_info_fields) {
18- var slc_fld = evt[sliced_info_fields[sl_fld]];
19- if (typeof slc_fld == 'object') {
20- res_description.push(slc_fld[slc_fld.length - 1]);
21- } else if (slc_fld) {
22- res_description.push(slc_fld);
23- }
24- }
25+ res_text = _.map(this.info_fields, function(fld) {
26+ if(evt[fld] instanceof Array)
27+ return evt[fld][1];
28+ return evt[fld];
29+ });
30 }
31 if (!date_stop && date_delay) {
32 date_stop = date_start.clone().addHours(date_delay);
33@@ -265,9 +257,8 @@
34 var r = {
35 'start_date': date_start.toString('yyyy-MM-dd HH:mm:ss'),
36 'end_date': date_stop.toString('yyyy-MM-dd HH:mm:ss'),
37- 'text': res_text,
38- 'id': evt.id,
39- 'title': res_description.join()
40+ 'text': res_text.join(),
41+ 'id': evt.id
42 };
43 if (evt.color) {
44 r.color = evt.color;