aboutsummaryrefslogtreecommitdiffstats
path: root/demo/templates
diff options
context:
space:
mode:
Diffstat (limited to 'demo/templates')
-rw-r--r--demo/templates/base.html.j219
-rw-r--r--demo/templates/frag_aside.html.j227
-rw-r--r--demo/templates/frag_aside_link.html.j29
-rw-r--r--demo/templates/frag_error.html.j216
-rw-r--r--demo/templates/frag_form_delete.html.j27
-rw-r--r--demo/templates/frag_form_find.html.j27
-rw-r--r--demo/templates/frag_form_range.html.j221
-rw-r--r--demo/templates/frag_form_upsert.html.j25
-rw-r--r--demo/templates/frag_results.html.j218
-rw-r--r--demo/templates/page_error.html.j25
-rw-r--r--demo/templates/page_main.html.j211
11 files changed, 145 insertions, 0 deletions
diff --git a/demo/templates/base.html.j2 b/demo/templates/base.html.j2
new file mode 100644
index 0000000..47b3f6c
--- /dev/null
+++ b/demo/templates/base.html.j2
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="preload" href="/static/InclusiveSans-Regular.ttf" as="font" type="font/woff2" crossorigin="anonymous">
+ <link rel="stylesheet" href="/static/styles.css"></link>
+ {% block head_meta %}
+ <title>Database browser</title>
+ <meta name="description" content="Database browser for log_db">
+ {% endblock %}
+</head>
+<body>
+ <h1><a href="/">Database browser</a></h1>
+ {% block content %}{% endblock %}
+
+ <script src="/static/htmp.js"></script>
+</body>
+</html>
diff --git a/demo/templates/frag_aside.html.j2 b/demo/templates/frag_aside.html.j2
new file mode 100644
index 0000000..6c5658f
--- /dev/null
+++ b/demo/templates/frag_aside.html.j2
@@ -0,0 +1,27 @@
+{#
+Params
+ selected_form Form fragment to include
+#}
+
+<aside id="aside">
+ <h3>Read operations</h3>
+ <ul>
+ {% with href="/find", text="Find" %}
+ <li>{% include "frag_aside_link.html.j2" %}</li>
+ {% endwith %}
+ {% with href="/range", text="Range" %}
+ <li>{% include "frag_aside_link.html.j2" %}</li>
+ {% endwith %}
+ </ul>
+ <h3>Write operations</h3>
+ <ul>
+ {% with href="/upsert", text="Upsert" %}
+ <li>{% include "frag_aside_link.html.j2" %}</li>
+ {% endwith %}
+ {% with href="/delete", text="Delete" %}
+ <li>{% include "frag_aside_link.html.j2" %}</li>
+ {% endwith %}
+ </ul>
+
+ {% include selected_form %}
+</aside>
diff --git a/demo/templates/frag_aside_link.html.j2 b/demo/templates/frag_aside_link.html.j2
new file mode 100644
index 0000000..9cd6041
--- /dev/null
+++ b/demo/templates/frag_aside_link.html.j2
@@ -0,0 +1,9 @@
+{#
+Params
+ text Text to render in the link
+ href URL to link to
+#}
+
+<form method="GET" action="{{ href }}" htmp replace=form_query>
+ <button class="link" type="submit">{{ text }}</button>
+</form>
diff --git a/demo/templates/frag_error.html.j2 b/demo/templates/frag_error.html.j2
new file mode 100644
index 0000000..c5034cd
--- /dev/null
+++ b/demo/templates/frag_error.html.j2
@@ -0,0 +1,16 @@
+{#
+Params
+ error Error message to display
+ container (optional) id for a div to wrap the error message in
+#}
+
+{% if container %}
+<div id="{{ container }}">
+{% endif %}
+
+<h2>Error</h2>
+{{ error }}
+
+{% if container %}
+</div>
+{% endif %}
diff --git a/demo/templates/frag_form_delete.html.j2 b/demo/templates/frag_form_delete.html.j2
new file mode 100644
index 0000000..22306c1
--- /dev/null
+++ b/demo/templates/frag_form_delete.html.j2
@@ -0,0 +1,7 @@
+<form id="form_query" action="/delete" method="post" htmp replace=results>
+ <label for="field">Field</label>
+ <input type="text" name="field" id="field" required>
+ <label for="value">Value</label>
+ <input type="text" name="value" id="value" required>
+ <button type="submit">Run query</button>
+</form>
diff --git a/demo/templates/frag_form_find.html.j2 b/demo/templates/frag_form_find.html.j2
new file mode 100644
index 0000000..cadd44b
--- /dev/null
+++ b/demo/templates/frag_form_find.html.j2
@@ -0,0 +1,7 @@
+<form id="form_query" action="/find" method="post" htmp replace=results>
+ <label for="field">Field</label>
+ <input type="text" name="field" id="field" required>
+ <label for="values">Values (one per line)</label>
+ <textarea name="values" id="values" required></textarea>
+ <button type="submit">Run query</button>
+</form>
diff --git a/demo/templates/frag_form_range.html.j2 b/demo/templates/frag_form_range.html.j2
new file mode 100644
index 0000000..84b8024
--- /dev/null
+++ b/demo/templates/frag_form_range.html.j2
@@ -0,0 +1,21 @@
+<form id="form_query" action="/range" method="post" htmp replace=results>
+ <label for="field">Field</label>
+ <input type="text" name="field" id="field" required>
+ <label for="from_type">Lower bound type</label>
+ <select id="from_type" name="from_type" required>
+ <option value="unbounded">Unbounded</option>
+ <option value="included">Inclusive</option>
+ <option value="excluded">Exclusive</option>
+ </select>
+ <label for="values">Lower bound value</label>
+ <input type="text" name="from_value" id="from_value">
+ <label for="to_type">Upper bound type</label>
+ <select id="to_type" name="to_type" required>
+ <option value="unbounded">Unbounded</option>
+ <option value="included">Inclusive</option>
+ <option value="excluded">Exclusive</option>
+ </select>
+ <label for="values">Upper bound value</label>
+ <input type="text" name="to_value" id="to_value">
+ <button type="submit">Run query</button>
+</form>
diff --git a/demo/templates/frag_form_upsert.html.j2 b/demo/templates/frag_form_upsert.html.j2
new file mode 100644
index 0000000..68820f5
--- /dev/null
+++ b/demo/templates/frag_form_upsert.html.j2
@@ -0,0 +1,5 @@
+<form id="form_query" action="/upsert" method="post" htmp replace=results>
+ <label for="values">Values (one per line)</label>
+ <textarea name="values" id="values" required></textarea>
+ <button type="submit">Run query</button>
+</form>
diff --git a/demo/templates/frag_results.html.j2 b/demo/templates/frag_results.html.j2
new file mode 100644
index 0000000..bfb54e9
--- /dev/null
+++ b/demo/templates/frag_results.html.j2
@@ -0,0 +1,18 @@
+<table id="results">
+<thead>
+ <tr>
+ {% for field_name in field_names %}
+ <th>{{ field_name }}</th>
+ {% endfor %}
+ </tr>
+</thead>
+<tbody>
+ {% for row in rows %}
+ <tr>
+ {% for field in row %}
+ <td>{{ field }}</td>
+ {% endfor %}
+ </tr>
+ {% endfor %}
+</tbody>
+</table>
diff --git a/demo/templates/page_error.html.j2 b/demo/templates/page_error.html.j2
new file mode 100644
index 0000000..3233283
--- /dev/null
+++ b/demo/templates/page_error.html.j2
@@ -0,0 +1,5 @@
+{% extends "base.html.j2" %}
+
+{% block content %}
+{% include "frag_error.html.j2" %}
+{% endblock %}
diff --git a/demo/templates/page_main.html.j2 b/demo/templates/page_main.html.j2
new file mode 100644
index 0000000..907275f
--- /dev/null
+++ b/demo/templates/page_main.html.j2
@@ -0,0 +1,11 @@
+{% extends "base.html.j2" %}
+
+{% block content %}
+<div id="container">
+ {% include "frag_aside.html.j2" %}
+
+ <main id="main">
+ {% include "frag_results.html.j2" %}
+ </main>
+</div>
+{% endblock %}