51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
class TemplatesDecisionDialog extends EICDialogContent {
|
|
|
|
actions = [
|
|
{
|
|
label: 'Cancel',
|
|
onclick: this.cancel.bind(this),
|
|
severity: 'secondary',
|
|
role: 'cancel'
|
|
},
|
|
{
|
|
label: 'Validate',
|
|
onclick: this.validate.bind(this),
|
|
severity: 'primary',
|
|
role: 'validate',
|
|
disabled: true
|
|
}
|
|
]
|
|
|
|
constructor() {
|
|
super()
|
|
Object.assign(this, app.helpers.validators)
|
|
}
|
|
|
|
DOMContentLoaded(options) {
|
|
this.form = new Form(this.find('.decision-dialog'));
|
|
this.decisionTextarea = this.find('.tpl-decision');
|
|
|
|
this.decisionTextarea.addEventListener('keyup', this.checkDecisionTextarea.bind(this))
|
|
|
|
}
|
|
|
|
checkDecisionTextarea(event) {
|
|
event.preventDefault()
|
|
event.stopPropagation()
|
|
if (this.decisionTextarea.value.trim().length > 0) {
|
|
this.actions.find(o => o.role == 'validate').button.disabled = false
|
|
}
|
|
}
|
|
|
|
validate() {
|
|
let data = { comment: this.decisionTextarea.value }
|
|
this.commit(data)
|
|
}
|
|
|
|
onFailed() {
|
|
this.abort()
|
|
}
|
|
|
|
}
|
|
|
|
app.registerClass('TemplatesDecisionDialog', TemplatesDecisionDialog); |