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

View file

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