summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorrde <rde@odoo.com>2017-09-22 14:16:58 +0200
committerJeremy Kersten <jke@odoo.com>2017-09-25 10:53:28 +0200
commitb94939377a7dee66f7860f4ef9e59be85cccf2ba (patch)
tree4dfeff5bac5047efc61825a0e3a06be0bc951fde /addons/web/static/src/js/core
parenta40236d38a8f178b21d674e22aab5120bcce034c (diff)
[IMP] web: improve renderCheckbox to be re-usable in front end
Before this commit, the label was into a display block that add a return line between the cehckbox and the label. It was not visible in backend, because label by defaut is displayed without renderCheckbox. (no options.text provided) Now renderCheckbox render correctly with the same code in frontend and backend
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/dom.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js
index 6ca13f18e4e..da125aa72af 100644
--- a/addons/web/static/src/js/core/dom.js
+++ b/addons/web/static/src/js/core/dom.js
@@ -265,19 +265,19 @@ return {
* @returns {jQuery}
*/
renderCheckbox: function (options) {
- var $container = $('<div class="o_checkbox"><input type="checkbox"/><span/></div>');
+ var $container = $('<div class="checkbox o_checkbox"><label><input type="checkbox"/><span/></label></div>');
if (options && options.prop) {
- $container.children('input').prop(options.prop);
+ $container.find('input').prop(options.prop);
}
if (options && options.text) {
- $container = $('<label/>').append(
- $container,
+ $container.find('label').append(
$('<span/>', {
- class: 'ml8',
text: options.text,
+ class: 'o_checkbox_label',
})
);
}
+
return $container;
},
/**