[DE] Refactoring

This commit is contained in:
Julia Radzhabova 2022-12-16 18:28:02 +03:00
parent 4a97fcd4d1
commit 4be1ab700b
2 changed files with 11 additions and 12 deletions

View file

@ -56,7 +56,8 @@ define([
maxlength : undefined,
placeHolder : '',
spellcheck : false,
disabled: false
disabled: false,
resize: false
},
template: _.template([
@ -133,6 +134,7 @@ define([
this._input.on('blur', _.bind(this.onInputChanged, this));
this._input.on('keydown', _.bind(this.onKeyDown, this));
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
if (!this.resize) this._input.css('resize', 'none');
if (this.disabled)
this.setDisabled(this.disabled);

View file

@ -79,7 +79,7 @@ define([
'<div class="input-row">',
'<label>' + this.textInstructions + '</label>',
'</div>',
'<textarea id="id-dlg-sign-settings-instructions" class="form-control" style="width: 100%;height: 35px;margin-bottom: 10px;resize: none;"></textarea>',
'<div id="id-dlg-sign-settings-instructions">',
'<div id="id-dlg-sign-settings-date"></div>',
'</div>',
'<div class="footer center">',
@ -121,15 +121,12 @@ define([
disabled : this.type=='view'
});
me.textareaInstructions = this.$window.find('textarea');
me.textareaInstructions.val(this.textDefInstruction);
me.textareaInstructions.keydown(function (event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
event.stopPropagation();
}
me.textareaInstructions = new Common.UI.TextareaField({
el : $window.find('#id-dlg-sign-settings-instructions'),
style : 'width: 100%; height: 35px;margin-bottom: 10px;',
value : this.textDefInstruction,
disabled : this.type=='view'
});
(this.type=='view') ? this.textareaInstructions.attr('disabled', 'disabled') : this.textareaInstructions.removeAttr('disabled');
this.textareaInstructions.toggleClass('disabled', this.type=='view');
this.chDate = new Common.UI.CheckBox({
el: $('#id-dlg-sign-settings-date'),
@ -160,7 +157,7 @@ define([
value = props.asc_getEmail();
me.inputEmail.setValue(value ? value : '');
value = props.asc_getInstructions();
me.textareaInstructions.val(value ? value : '');
me.textareaInstructions.setValue(value ? value : '');
me.chDate.setValue(props.asc_getShowDate());
me._currentGuid = props.asc_getGuid();
@ -174,7 +171,7 @@ define([
props.asc_setSigner1(me.inputName.getValue());
props.asc_setSigner2(me.inputTitle.getValue());
props.asc_setEmail(me.inputEmail.getValue());
props.asc_setInstructions(me.textareaInstructions.val());
props.asc_setInstructions(me.textareaInstructions.getValue());
props.asc_setShowDate(me.chDate.getValue()=='checked');
(me._currentGuid!==undefined) && props.asc_setGuid(me._currentGuid);