aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2024-03-23 19:01:29 +0000
committerJuan J. Martinez <jjm@usebox.net>2024-03-23 19:10:43 +0000
commit0a5471217b9f562b92f32802de4260390f639880 (patch)
treedaf0655fe2753351d7fac9010e3b50c499194bb2 /views
downloadpersonal-wiki-pybottle-0a5471217b9f562b92f32802de4260390f639880.tar.gz
personal-wiki-pybottle-0a5471217b9f562b92f32802de4260390f639880.zip
Initial import
Diffstat (limited to 'views')
-rw-r--r--views/edit.tpl10
-rw-r--r--views/footer.tpl3
-rw-r--r--views/header.tpl14
-rw-r--r--views/history.tpl17
-rw-r--r--views/page.tpl21
5 files changed, 65 insertions, 0 deletions
diff --git a/views/edit.tpl b/views/edit.tpl
new file mode 100644
index 0000000..5e0f35b
--- /dev/null
+++ b/views/edit.tpl
@@ -0,0 +1,10 @@
+% include('header.tpl', title=f"Edit {page.name}")
+
+ <form action="/edit/{{page.name}}" method="post">
+ <textarea name="content" rows="20" required>{{page.content}}</textarea>
+ <label for="changelog">Changelog (optional)</label> <input class="changelog" name="changelog" type="text" value="">
+ <input value="Save" type="submit">
+ <p>Or <a href="/{{page.name}}">Cancel</a></p>
+ </form>
+
+% include('footer.tpl')
diff --git a/views/footer.tpl b/views/footer.tpl
new file mode 100644
index 0000000..f5471aa
--- /dev/null
+++ b/views/footer.tpl
@@ -0,0 +1,3 @@
+ </div>
+</body>
+</html>
diff --git a/views/header.tpl b/views/header.tpl
new file mode 100644
index 0000000..83c2046
--- /dev/null
+++ b/views/header.tpl
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+ <title>Wiki - {{page.title}}</title>
+ <link rel="stylesheet" href="/static/water.min.css">
+ <link rel="stylesheet" href="/static/wiki.css">
+</head>
+<body>
+ <header>
+ <h1><a href="/{{page.name}}">{{page.title}}</a></h1>
+ </header>
+ <div id="content">
diff --git a/views/history.tpl b/views/history.tpl
new file mode 100644
index 0000000..5e0d42a
--- /dev/null
+++ b/views/history.tpl
@@ -0,0 +1,17 @@
+% include('header.tpl', page=page)
+
+ <h2>History</h2>
+ <ul>
+ % for h in history:
+ <li><a href="/history/{{page.name}}/{{h.version}}">View</a> -
+ % if h.changelog:
+ <em>{{h.changelog}}</em>
+ % else:
+ (no changelog)
+ % end
+ <br>Updated on {{h.updated_at}}
+ </li>
+ % end
+ </ul>
+
+% include('footer.tpl')
diff --git a/views/page.tpl b/views/page.tpl
new file mode 100644
index 0000000..4a4189a
--- /dev/null
+++ b/views/page.tpl
@@ -0,0 +1,21 @@
+% include('header.tpl', page=page)
+
+% if page.version is None:
+ <p><a href="/{{page.name}}">{{page.name}}</a> doesn't exist yet, <a href="/edit/{{page.name}}">create it</a>!</p>
+% else:
+ {{!page.render()}}
+ <hr>
+ <p>
+ % if not page.history:
+ <a href="/edit/{{page.name}}">Edit</a> :
+ % end
+ <a href="/history/{{page.name}}">History</a> :
+ % if page.history:
+ <a href="/restore/{{page.name}}/{{page.version}}">Restore</a> :
+ <a href="/delete/{{page.name}}/{{page.version}}">Delete</a>
+ % end
+ - Last updated: {{page.updated_at}}
+ </p>
+% end
+
+% include('footer.tpl')