[FIX] web: highlight clickable pivot cells on hover
After a recent reorganization of the web client's components tree, the class 'o_enable_linking' was added on the wrong element. This made the css rule responsible of the highlighting of the clickable pivot cells impossible to satisfy. This commit fixes the issue by adding the class directly in the template 'PivotView'. Additionally, this commit also makes visually clear when a field selection menu-items is disabled (because it is already used) using a 'not-allowed' cursor (which was removed in bs4). It is now again possible to open a list view by clicking on a cell with zero value (like in Odoo 11). task-1916889 closes odoo/odoo#34165 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
This commit is contained in:
committed by
Dharmraj Jhala
parent
669b224f66
commit
696e31d307
@@ -53,7 +53,6 @@ var PivotController = AbstractController.extend({
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
this.$el.toggleClass('o_enable_linking', this.enableLinking);
|
||||
this.$fieldSelection = this.$('.o_field_selection');
|
||||
core.bus.on('click', this, function () {
|
||||
this.$fieldSelection.empty();
|
||||
|
||||
@@ -283,7 +283,7 @@ var PivotRenderer = AbstractRenderer.extend({
|
||||
$cell = $('<td>')
|
||||
.data('id', rows[i].id)
|
||||
.data('col_id', rows[i].col_ids[Math.floor(j / nbrMeasures)])
|
||||
.toggleClass('o_empty', !value)
|
||||
.toggleClass('o_empty', _.isUndefined(value))
|
||||
.addClass('o_pivot_cell_value text-right');
|
||||
if (value !== undefined) {
|
||||
$cell.append($('<div>', {class: 'o_value'}).html(formatter(value, measure)));
|
||||
|
||||
@@ -87,4 +87,9 @@
|
||||
right: 6px;
|
||||
top: 9px;
|
||||
}
|
||||
|
||||
.o_pivot_field_menu .dropdown-item.disabled {
|
||||
color: $text-muted;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div t-name="PivotView" class="o_pivot">
|
||||
<div t-name="PivotView" t-attf-class="o_pivot #{widget.enableLinking ? 'o_enable_linking' : ''}">
|
||||
<div class="o_field_selection"/>
|
||||
</div>
|
||||
<t t-name="PivotView.buttons">
|
||||
|
||||
@@ -106,7 +106,7 @@ QUnit.module('Views', {
|
||||
},
|
||||
});
|
||||
|
||||
assert.hasClass(pivot.$el,'o_enable_linking',
|
||||
assert.hasClass(pivot.$('.o_pivot'),'o_enable_linking',
|
||||
"root node should have classname 'o_enable_linking'");
|
||||
assert.strictEqual(pivot.$('td.o_pivot_cell_value:contains(32)').length, 1,
|
||||
"should contain a pivot cell with the sum of all records");
|
||||
@@ -269,7 +269,7 @@ QUnit.module('Views', {
|
||||
}
|
||||
});
|
||||
|
||||
assert.hasClass(pivot.$el,'o_enable_linking',
|
||||
assert.hasClass(pivot.$('.o_pivot'),'o_enable_linking',
|
||||
"root node should have classname 'o_enable_linking'");
|
||||
testUtils.dom.click(pivot.$('.o_pivot_cell_value:contains(12)')); // should trigger a do_action
|
||||
|
||||
@@ -293,7 +293,7 @@ QUnit.module('Views', {
|
||||
},
|
||||
});
|
||||
|
||||
assert.doesNotHaveClass(pivot.$el, 'o_enable_linking',
|
||||
assert.doesNotHaveClass(pivot.$('.o_pivot'), 'o_enable_linking',
|
||||
"root node should not have classname 'o_enable_linking'");
|
||||
assert.containsOnce(pivot, '.o_pivot_cell_value',
|
||||
"should have one cell");
|
||||
|
||||
Reference in New Issue
Block a user