[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-20131231090257-y0os22omx0pgjaqb
This commit is contained in:
Gery Debongnie 2013-12-31 10:02:57 +01:00
parent c189cd2378
commit 3d5b03af08
2 changed files with 38 additions and 26 deletions

View File

@ -1,15 +1,40 @@
.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;
color: #669;
text-align: left;
border-right: 1px solid #6678b1;
white-space: nowrap;
}
.graph_main_content tbody tr:hover td
{
color: #009;
}
span.field-selection {
display: none;
padding: 0;
@ -23,18 +48,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;

View File

@ -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 $('<td></td>').addClass('graph_border')
make_border_cell: function (colspan, rowspan, headercell) {
var tag = (headercell) ? $('<th></th>') : $('<td></td>');
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 = $('<thead></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($('<tr></tr>').append(cells));
thead.append($('<tr></tr>').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 = $('<td></td>');
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;
}