[FIX] web, portal: checkbox rendering
This reverts commit b94939377a.
The commit was breaking most of the backend checkboxes trying to fix a
frontend one.
On top of the revert, this commit adds frontend-only style to fix the
frontend checkboxes.
This commit is contained in:
@@ -64,3 +64,12 @@ body.o_connected_user {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO should be a common backend/frontend style
|
||||
div.o_checkbox {
|
||||
display: inline-block;
|
||||
vertical-align: sub;
|
||||
> input + span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,19 +265,19 @@ return {
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
renderCheckbox: function (options) {
|
||||
var $container = $('<div class="checkbox o_checkbox"><label><input type="checkbox"/><span/></label></div>');
|
||||
var $container = $('<div class="o_checkbox"><input type="checkbox"/><span/></div>');
|
||||
if (options && options.prop) {
|
||||
$container.find('input').prop(options.prop);
|
||||
$container.children('input').prop(options.prop);
|
||||
}
|
||||
if (options && options.text) {
|
||||
$container.find('label').append(
|
||||
$container = $('<label/>').append(
|
||||
$container,
|
||||
$('<span/>', {
|
||||
class: 'ml8',
|
||||
text: options.text,
|
||||
class: 'o_checkbox_label',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return $container;
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -4,17 +4,8 @@
|
||||
div.o_checkbox {
|
||||
display: inline-block;
|
||||
vertical-align: sub;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
input[type="checkbox"] {
|
||||
position: inherit;
|
||||
margin-left: 0;
|
||||
}
|
||||
> label {
|
||||
padding-left: 0px;
|
||||
> input + span {
|
||||
display: none;
|
||||
}
|
||||
> input + span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1741,10 +1741,10 @@ QUnit.module('Views', {
|
||||
res_id: 1,
|
||||
});
|
||||
|
||||
assert.strictEqual(form.$("label:not(.o_checkbox label)").length, 2, "should have rendered only two label");
|
||||
assert.strictEqual(form.$("label:not(.o_checkbox label)").first().text(), "Product",
|
||||
assert.strictEqual(form.$("label").length, 2, "should have rendered only two label");
|
||||
assert.strictEqual(form.$("label").first().text(), "Product",
|
||||
"one should be the one for the product field");
|
||||
assert.strictEqual(form.$("label:not(.o_checkbox label)").eq(1).text(), "Bar",
|
||||
assert.strictEqual(form.$("label").eq(1).text(), "Bar",
|
||||
"one should be the one for the bar field");
|
||||
|
||||
assert.strictEqual(form.$('.firstgroup td').first().attr('colspan'), undefined,
|
||||
@@ -3787,7 +3787,7 @@ QUnit.module('Views', {
|
||||
"button box should contain two children");
|
||||
assert.strictEqual(form.$('.oe_button_box .oe_stat_button').length, 1,
|
||||
"button box should only contain one button");
|
||||
assert.strictEqual(form.$('.oe_button_box label:not(.o_checkbox label)').length, 1,
|
||||
assert.strictEqual(form.$('.oe_button_box label').length, 1,
|
||||
"button box should only contain one label");
|
||||
|
||||
form.destroy();
|
||||
|
||||
Reference in New Issue
Block a user