Put textarea and richtext under an input-group

If the widget is translatable, the translate button is an input-group-btn
which must be under the same input-group as the principal input.

Closes #13238
(grafted from 20af97ade53035f1c725cb2600e9abbb2664f664)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-05-14 19:44:39 +02:00
1 parent dd9abf6119
commit 730132a931
2 files changed
+15 -9

No files matched your search

+1 -1
View File
@@ -724,7 +724,7 @@ img.icon {
}
}
.form-text, .form-richtext {
> textarea, .richtext {
textarea, .richtext {
height: 100%;
line-height: 2.5ex;
min-height: 12.5ex;
+14 -8
View File
@@ -2272,10 +2272,13 @@ function eval_pyson(value){
this.el = jQuery('<div/>', {
'class': this.class_
});
this.group = jQuery('<div/>', {
'class': 'input-group',
}).appendTo(this.el);
this.input = this.labelled = jQuery('<textarea/>', {
'class': 'form-control input-sm mousetrap',
'name': attributes.name,
}).appendTo(this.el);
}).appendTo(this.group);
this.input.change(this.focus_out.bind(this));
this.input.on('keydown', this.send_modified.bind(this));
if (this.attributes.translate) {
@@ -2286,7 +2289,7 @@ function eval_pyson(value){
'title': Sao.i18n.gettext("Translate"),
}).appendTo(jQuery('<span/>', {
'class': 'input-group-btn'
}).appendTo(this.el));
}).appendTo(this.group));
button.append(
Sao.common.ICONFACTORY.get_icon_img('tryton-translate'));
button.click(this.translate.bind(this));
@@ -2362,13 +2365,16 @@ function eval_pyson(value){
'class': 'panel-heading',
}).appendTo(this.el));
}
this.group = jQuery('<div/>', {
'class': 'input-group',
}).appendTo(jQuery('<div/>', {
'class': 'panel-body',
}).appendTo(this.el));
this.input = this.labelled = jQuery('<div/>', {
'class': 'richtext mousetrap',
'contenteditable': true
}).appendTo(jQuery('<div/>', {
'class': 'panel-body'
}).appendTo(this.el));
this.el.focusout(this.focus_out.bind(this));
'contenteditable': true,
}).appendTo(this.group);
this.group.focusout(this.focus_out.bind(this));
if (this.attributes.translate) {
var button = jQuery('<button/>', {
'class': 'btn btn-default btn-sm form-control',
@@ -2377,7 +2383,7 @@ function eval_pyson(value){
'title': Sao.i18n.gettext("Translate"),
}).appendTo(jQuery('<span/>', {
'class': 'input-group-btn',
}).appendTo(this.el));
}).appendTo(this.group));
button.append(
Sao.common.ICONFACTORY.get_icon_img('tryton-translate'));
button.click(this.translate.bind(this));