From 805b3d19b921ac9e9e0f88e147d190666ba65cad Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 31 Dec 2013 09:38:41 +0100 Subject: [PATCH] [IMP] changes the css of the pivot table to make it look decent (at least, not as awful as before), (addon web_graph) bzr revid: ged@openerp.com-20131231083841-axsv4078irq7xzov --- addons/web_graph/static/src/css/graph.css | 46 ++++++++++++++--------- addons/web_graph/static/src/js/graph.js | 19 +++++----- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/addons/web_graph/static/src/css/graph.css b/addons/web_graph/static/src/css/graph.css index 764fcdca209..5130e3d03f4 100644 --- a/addons/web_graph/static/src/css/graph.css +++ b/addons/web_graph/static/src/css/graph.css @@ -1,13 +1,37 @@ .graph_main_content td { - border: 1px solid black; - padding: 0.5rem; + font-size: 12px; + background: #fff; + margin: 45px; + border-collapse: collapse; + text-align: left; + vertical-align: middle; +} + +.graph_main_content th { + font-size: 13px; + font-weight: normal; + color: #039; + padding: 10px 8px; + border-bottom: 2px solid #6678b1; + vertical-align: top; +} + +.graph_main_content td { + border-bottom: 1px solid #ccc; + padding: 6px 8px; text-align: right; + text-color: black; } td.graph_border { - background-color: rgb(227, 227, 227); - text-align: left; - white-space: nowrap; + color: #669; + text-align: left; + border-right: 1px solid #6678b1; +} + +.graph_main_content tbody tr:hover td +{ + color: #009; } span.field-selection { @@ -23,18 +47,6 @@ span.web_graph_indent { cursor: pointer; } -tr.graph_top td { - text-align: center; -} - -tr.graph_top li { - text-align: left; -} - -.graph_main_content tr:hover { - background-color: rgb(245,245,245); -} - .graph_widget .dropdown-menu { font-size: 13px; padding: 4px 0; diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 80b7eb07d6c..9fcb7f3ea8e 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -397,8 +397,9 @@ instance.web_graph.Graph = instance.web.Widget.extend({ return (this.pivot.measure) ? this.fields[this.pivot.measure].string : 'Quantity'; }, - make_border_cell: function (colspan, rowspan) { - return $('').addClass('graph_border') + make_border_cell: function (colspan, rowspan, headercell) { + var tag = (headercell) ? $('') : $(''); + return tag.addClass('graph_border') .attr('colspan', (colspan) ? colspan : 1) .attr('rowspan', (rowspan) ? rowspan : 1); }, @@ -413,9 +414,10 @@ instance.web_graph.Graph = instance.web.Widget.extend({ draw_top_headers: function () { var self = this, + thead = $(''), pivot = this.pivot, height = _.max(_.map(pivot.cols.headers, function(g) {return g.path.length;})), - header_cells = [[this.make_border_cell(1, height)]]; + header_cells = [[this.make_border_cell(1, height, true)]]; function set_dim (cols) { _.each(cols.children, set_dim); @@ -429,7 +431,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({ } function make_col_header (col) { - var cell = self.make_border_cell(col.width, col.height); + var cell = self.make_border_cell(col.width, col.height, true); return cell.append(self.make_header_title(col).attr('data-id', col.id)); } @@ -452,12 +454,13 @@ instance.web_graph.Graph = instance.web.Widget.extend({ make_cells(pivot.cols.headers, 0); } else { make_cells(pivot.cols.main.children, 1); - header_cells[0].push(self.make_border_cell(1, height).append('Total').css('font-weight', 'bold')); + header_cells[0].push(self.make_border_cell(1, height, true).append('Total').css('font-weight', 'bold')); } _.each(header_cells, function (cells) { - self.table.append($('').append(cells)); + thead.append($('').append(cells)); }); + self.table.append(thead); }, get_measure_type: function () { @@ -500,10 +503,6 @@ instance.web_graph.Graph = instance.web.Widget.extend({ var color, total, cell = $(''); - if ((self.mode === 'pivot') && (row.is_expanded) && (row.path.length <=2)) { - color = row.path.length * 5 + 240; - cell.css('background-color', $.Color(color, color, color)); - } if (value === undefined) { return cell; }