Fix dialogs
This commit is contained in:
parent
976c57c043
commit
116d5b9b00
@ -8,7 +8,7 @@ interface ModalButton {
|
||||
dismiss?: boolean;
|
||||
}
|
||||
|
||||
export default class ModalDialog {
|
||||
export default abstract class ModalDialog {
|
||||
private _showing: any;
|
||||
|
||||
private _dismiss: HTMLButtonElement | null;
|
||||
@ -87,9 +87,8 @@ export default class ModalDialog {
|
||||
return el;
|
||||
}
|
||||
|
||||
getContent(): Promise<DocumentFragment | HTMLElement> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
abstract getContent():
|
||||
Promise<DocumentFragment | HTMLElement> | HTMLElement | DocumentFragment;
|
||||
|
||||
get buttons(): ModalButton[] {
|
||||
return [
|
||||
@ -205,7 +204,7 @@ export default class ModalDialog {
|
||||
*/
|
||||
static async inform(title: string, text: string, oktext: string) {
|
||||
const dialog = new class extends ModalDialog {
|
||||
get content() {
|
||||
getContent() {
|
||||
const rv = document.createDocumentFragment();
|
||||
const h = document.createElement("h1");
|
||||
h.textContent = title || "Information";
|
||||
@ -241,7 +240,7 @@ export default class ModalDialog {
|
||||
|
||||
static async confirm(title: string, text: string) {
|
||||
const dialog = new class extends ModalDialog {
|
||||
get content() {
|
||||
getContent() {
|
||||
const rv = document.createDocumentFragment();
|
||||
const h = document.createElement("h1");
|
||||
h.textContent = title || "Confirm";
|
||||
@ -280,7 +279,7 @@ export default class ModalDialog {
|
||||
const dialog = new class extends ModalDialog {
|
||||
_input: HTMLInputElement;
|
||||
|
||||
get content() {
|
||||
getContent() {
|
||||
const rv = document.createDocumentFragment();
|
||||
const h = document.createElement("h1");
|
||||
h.textContent = title || "Confirm";
|
||||
|
@ -116,7 +116,7 @@ class CreateFilterDialog extends ModalDialog {
|
||||
this.expr = $("#filter-create-expr", rv);
|
||||
this.link = $("#filter-create-type-link", rv);
|
||||
this.media = $("#filter-create-type-media", rv);
|
||||
return Promise.resolve(rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
get buttons() {
|
||||
|
@ -51,10 +51,9 @@ function matched(item: any) {
|
||||
}
|
||||
|
||||
class PausedModalDialog extends ModalDialog {
|
||||
get content() {
|
||||
getContent() {
|
||||
const tmpl = $<HTMLTemplateElement>("#paused-template");
|
||||
const content = tmpl.content.cloneNode(true) as DocumentFragment;
|
||||
localize(content);
|
||||
return content;
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,9 @@ class BatchModalDialog extends ModalDialog {
|
||||
this.gen = gen;
|
||||
}
|
||||
|
||||
get content() {
|
||||
getContent() {
|
||||
const tmpl = $("#batch-template") as HTMLTemplateElement;
|
||||
const content = tmpl.content.cloneNode(true) as DocumentFragment;
|
||||
localize(content);
|
||||
$(".batch-items", content).textContent = this.gen.length.toLocaleString();
|
||||
$(".batch-preview", content).textContent = this.gen.preview;
|
||||
return content;
|
||||
|
Loading…
x
Reference in New Issue
Block a user