changeset 33d542c5df16 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=33d542c5df16
description:
Set readonly all date inputs and hide icon
issue10393
review344141002
diffstat:
src/view/form.js | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (38 lines):
diff -r 3e322f4fc847 -r 33d542c5df16 src/view/form.js
--- a/src/view/form.js Mon May 03 15:33:40 2021 +0200
+++ b/src/view/form.js Sun May 16 17:45:03 2021 +0200
@@ -1628,14 +1628,14 @@
}
}.bind(this));
if (this.input[0].type == this._input) {
- var icon = jQuery('<div/>', {
+ this.icon = jQuery('<div/>', {
'class': 'icon-input icon-secondary',
'aria-label': Sao.i18n.gettext("Open the calendar"),
'title': Sao.i18n.gettext("Open the calendar"),
}).appendTo(group);
- this.input.appendTo(icon);
+ this.input.appendTo(this.icon);
Sao.common.ICONFACTORY.get_icon_img('tryton-date')
- .appendTo(icon);
+ .appendTo(this.icon);
}
this.date.css('max-width', this._width);
this.date.change(this.focus_out.bind(this));
@@ -1701,8 +1701,14 @@
},
set_readonly: function(readonly) {
Sao.View.Form.Date._super.set_readonly.call(this, readonly);
- this.date.find('button').prop('disabled', readonly);
- this.date.find('input').prop('readonly', readonly);
+ this.el.find('input').prop('readonly', readonly);
+ if (this.icon){
+ if (readonly) {
+ this.icon.hide();
+ } else {
+ this.icon.show();
+ }
+ }
}
});