unclean SPARC
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user