aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2024-09-19 10:37:03 +0200
committerMartin Ridgers <[email protected]>2024-09-24 10:57:34 +0200
commit508af61f35807bd6c0bca3025128908a049d347e (patch)
tree5d68331512802819b43028c32a0ea8626464badd /src
parentAdded a Page.set_title() to replace free zen_title() (diff)
downloadzen-508af61f35807bd6c0bca3025128908a049d347e.tar.xz
zen-508af61f35807bd6c0bca3025128908a049d347e.zip
Test page of dashboard widgets
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/frontend/html/zen.js75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/zenserver/frontend/html/zen.js b/src/zenserver/frontend/html/zen.js
index e9bf97447..bae915258 100644
--- a/src/zenserver/frontend/html/zen.js
+++ b/src/zenserver/frontend/html/zen.js
@@ -484,6 +484,80 @@ class Project extends Page
////////////////////////////////////////////////////////////////////////////////
+class Test extends Page
+{
+ main()
+ {
+ var gen_word = (function() {
+ var s = 0x314251;
+ var r = function(a, b) {
+ s = (s * 0x493) & 0x7fffffff;
+ return ((s >> 3) % (b - a)) + a;
+ };
+ return function(a=5, b=10) {
+ const co = "aeioubcdfghjklmnpqrstvwxyz";
+ var ret = ""
+ for (var i = 0, n = r(a,b); i < n; ++i)
+ ret += co[r(0, co.length)];
+ return ret
+ };
+ })();
+ var gen_para = function(a=5, b=10, s=" ") {
+ var ret = gen_word(2, 9);
+ for (var i = 0; i < ((ret.length * 0x493) % (b - a)) + b; ++i)
+ ret += s + gen_word(2, 9);
+ return ret;
+ }
+
+ this.set_title("test");
+
+ // section
+ var section0 = this.add_section("section");
+ var section1 = section0.add_section("sub-section");
+ var section2 = section1.add_section("sub-sub-section");
+
+ // table
+ const cols = [gen_word(), gen_word(), gen_word(), gen_word()];
+ var tables = [
+ new Table(section0, cols),
+ new Table(section1, cols, 5),
+ new Table(section2, cols, -1),
+ ];
+
+ for (const table of tables)
+ {
+ table.add_row([gen_word()]);
+ table.add_row([gen_word(), gen_word(), gen_word(), gen_word()]);
+ table.add_row([gen_word(), gen_word(), gen_para(15, 25), gen_word(), gen_word(), gen_word(), gen_word(), gen_word()]);
+ }
+
+ // prop-table
+ var pt_section = section0.add_section("prop-table")
+ var prop_table = new PropTable(pt_section);
+ for (var i = 0; i < 7; ++i)
+ prop_table.add_property(gen_word(), gen_para(1, 14, "/"));
+
+ // misc
+ const misc_section = section0.add_section("misc").add_section("misc");
+ 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) => {
+ new Modal()
+ .title("modal")
+ .message("here is a message what I wrote")
+ .option("press me!", () => { alert("hi"); })
+ .option("cancel", () => void(0));
+ });
+
+ // error
+ throw Error("deliberate error");
+ }
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
class Start extends Page
{
async main()
@@ -560,6 +634,7 @@ async function main_guarded()
if (page == "project") impl = new Project(root, params);
if (page == "oplog") impl = new Oplog(root, params);
if (page == "entry") impl = new Entry(root, params);
+ if (page == "test") impl = new Test(root, params);
if (page == undefined) impl = new Start(root, params);
if (impl == undefined)