[FIX] add $ to jquery variables (addon web_graph)

the rendering code of the pivot table didn't use $ in jquery variables,
this commit fixes that issue and slightly simplify their names.

bzr revid: ged@openerp.com-20140508111311-kargzvzlttutwt47
This commit is contained in:
Gery Debongnie 2014-05-08 13:13:11 +02:00
parent 79c197814b
commit b9c217e850
1 changed files with 21 additions and 21 deletions

View File

@ -540,51 +540,51 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
.addClass('graph_border') .addClass('graph_border')
.attr('rowspan', header.height) .attr('rowspan', header.height)
.attr('colspan', header.width); .attr('colspan', header.width);
var content = $('<span>').addClass('web_graph_click') var $content = $('<span>').addClass('web_graph_click')
.attr('href','#') .attr('href','#')
.text(' ' + (header.title || _t('Undefined'))) .text(' ' + (header.title || _t('Undefined')))
.css('margin-left', header.indent*30 + 'px') .css('margin-left', header.indent*30 + 'px')
.attr('data-id', header.id); .attr('data-id', header.id);
if (_.has(header, 'expanded')) { if (_.has(header, 'expanded')) {
content.addClass(header.expanded ? 'fa fa-minus-square' : 'fa fa-plus-square'); $content.addClass(header.expanded ? 'fa fa-minus-square' : 'fa fa-plus-square');
} else { } else {
content.css('font-weight', 'bold'); $content.css('font-weight', 'bold');
} }
return cell.append(content); return cell.append($content);
}, },
draw_headers: function (headers, doc_fragment) { draw_headers: function (headers, doc_fragment) {
var make_cell = this.make_header_cell, var make_cell = this.make_header_cell,
empty_cell = $('<th>').attr('rowspan', headers.length), $empty_cell = $('<th>').attr('rowspan', headers.length),
thead = $('<thead>'); $thead = $('<thead>');
_.each(headers, function (row) { _.each(headers, function (row) {
var html_row = $('<tr>'); var $row = $('<tr>');
_.each(row, function (header) { _.each(row, function (header) {
html_row.append(make_cell(header)); $row.append(make_cell(header));
}); });
thead.append(html_row); $thead.append($row);
}); });
thead.children(':first').prepend(empty_cell); $thead.children(':first').prepend($empty_cell);
doc_fragment.append(thead); doc_fragment.append($thead);
this.thead = thead; this.$thead = $thead;
}, },
draw_measure_row: function (measure_row, doc_fragment) { draw_measure_row: function (measure_row, doc_fragment) {
if (this.pivot.measures.length === 1) { return; } if (this.pivot.measures.length === 1) { return; }
var html_row = $('<tr>').append('<th>'); var $row = $('<tr>').append('<th>');
_.each(measure_row, function (cell) { _.each(measure_row, function (cell) {
var measure_cell = $('<th>').addClass('measure_row').text(cell.text); var $cell = $('<th>').addClass('measure_row').text(cell.text);
if (cell.is_bold) {measure_cell.css('font-weight', 'bold');} if (cell.is_bold) {$cell.css('font-weight', 'bold');}
html_row.append(measure_cell); $row.append($cell);
}); });
this.thead.append(html_row); this.$thead.append($row);
}, },
draw_rows: function (rows, doc_fragment) { draw_rows: function (rows, doc_fragment) {
var make_cell = this.make_header_cell, var make_cell = this.make_header_cell,
cell, cell,
html_row, i, j; $row, i, j;
var cells_list, var cells_list,
hcell, hcell,
@ -592,7 +592,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
rows_length = rows.length; rows_length = rows.length;
for (i = 0; i < rows_length; i++) { for (i = 0; i < rows_length; i++) {
html_row = $('<tr>').append(make_cell(rows[i])); $row = $('<tr>').append(make_cell(rows[i]));
cells_length = rows[i].cells.length; cells_length = rows[i].cells.length;
cells_list = []; cells_list = [];
@ -608,8 +608,8 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
hcell += '>' + cell.value + '</td>'; hcell += '>' + cell.value + '</td>';
cells_list[j] = hcell; cells_list[j] = hcell;
} }
html_row.append(cells_list.join('')); $row.append(cells_list.join(''));
doc_fragment.append($('<tbody>').append(html_row)); doc_fragment.append($('<tbody>').append($row));
} }
}, },