Skip to content

Instantly share code, notes, and snippets.

@minhhungit
Last active September 21, 2019 12:48
Show Gist options
  • Save minhhungit/702af50333ca65405d01e78514a5af80 to your computer and use it in GitHub Desktop.
Save minhhungit/702af50333ca65405d01e78514a5af80 to your computer and use it in GitHub Desktop.
constructor() {
super();
let sdsAddFileBtn = this.form.Sds.element.find(".add-file-button");
let sdsClickEvt = (e) => {
e.preventDefault();
if (Q.trimToNull(Serenity.EditorUtils.getValue(this.form.Sds)) !== null) {
Q.confirm("This will overwrite the current file. Are you sure you want to continue?", () => {
$(e.target).click();
sdsAddFileBtn.one('click', (e) => sdsClickEvt(e));
}, { onCancel: () => sdsAddFileBtn.one('click', (e) => sdsClickEvt(e)) });
}
else {
$(e.target).click();
sdsAddFileBtn.one('click', (e) => sdsClickEvt(e));
}
};
sdsAddFileBtn.one('click', (e) => sdsClickEvt(e));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment