aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2024-09-19 15:00:00 +0200
committerMartin Ridgers <[email protected]>2024-09-24 10:57:34 +0200
commitb8079378dd5ba99fc7b20f45e9237955ea3cd793 (patch)
tree4a6427fedf4cd4ff1af195d137ae451308e44255 /src
parentLet's try centering table cells' contents (diff)
downloadzen-b8079378dd5ba99fc7b20f45e9237955ea3cd793.tar.xz
zen-b8079378dd5ba99fc7b20f45e9237955ea3cd793.zip
Convenience on_click() that infers action class
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/frontend/html/zen.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/zenserver/frontend/html/zen.js b/src/zenserver/frontend/html/zen.js
index 177cbd299..33bf18c2b 100644
--- a/src/zenserver/frontend/html/zen.js
+++ b/src/zenserver/frontend/html/zen.js
@@ -92,6 +92,12 @@ class Component
this._element.addEventListener(what, thunk);
return this;
}
+
+ on_click(func)
+ {
+ this.classify("zen_action");
+ return this.on("click", func);
+ }
}
@@ -462,7 +468,7 @@ class Project extends Page
});
cell = cells.at(-1);
- cell.attr("zen_param", name).on("click", (e) => this._on_drop(e));
+ cell.attr("zen_param", name).on_click((e) => this._on_drop(e));
}
// files
@@ -574,7 +580,7 @@ class Test extends Page
misc_section.tag().text("just text");
misc_section.tag().text("this is a link").link();
// misc_section.tag().text("on() test").on("click", (e) => { alert(this); }).link();
- misc_section.tag().text("MODAL DIALOG").classify("zen_action").on("click", (e) => {
+ misc_section.tag().text("MODAL DIALOG").on_click((e) => {
new Modal()
.title("modal")
.message("here is a message what I wrote")