diff options
author | Juan J. Martinez <jjm@usebox.net> | 2024-03-23 21:57:17 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2024-03-23 21:57:17 +0000 |
commit | 5ccf2b593f5deebb219cc36f1a089c3238ba82fe (patch) | |
tree | 49e3555f72953432dc8dfe8b6555b894bca7ea5e | |
parent | e074abbcb7c193e0eb4ae990ad50ac371f01bce8 (diff) | |
download | personal-wiki-pybottle-main.tar.gz personal-wiki-pybottle-main.zip |
-rw-r--r-- | model.py | 6 | ||||
-rw-r--r-- | static/wiki.css | 4 | ||||
-rw-r--r-- | views/history.tpl | 2 | ||||
-rw-r--r-- | views/page.tpl | 12 | ||||
-rw-r--r-- | wiki.py | 4 |
5 files changed, 18 insertions, 10 deletions
@@ -17,6 +17,10 @@ def bootstrap_db(db): class Page(object): + @classmethod + def now(cls): + return datetime.utcnow().isoformat(sep=" ", timespec="seconds") + def __init__( self, name="WikiHome", @@ -26,7 +30,7 @@ class Page(object): updated_at=None, history=False, ): - now = datetime.utcnow() + now = Page.now() if updated_at is None: updated_at = now diff --git a/static/wiki.css b/static/wiki.css index cca58c8..68af565 100644 --- a/static/wiki.css +++ b/static/wiki.css @@ -2,6 +2,10 @@ body { min-width: 1024px; } +nav a { + margin-right: 0.5em; +} + #content { background-color: var(--background-alt); padding: 1em; diff --git a/views/history.tpl b/views/history.tpl index 5e0d42a..2fb2019 100644 --- a/views/history.tpl +++ b/views/history.tpl @@ -9,7 +9,7 @@ % else: (no changelog) % end - <br>Updated on {{h.updated_at}} + <br>Edited on {{h.updated_at}} </li> % end </ul> diff --git a/views/page.tpl b/views/page.tpl index 67b73aa..c577886 100644 --- a/views/page.tpl +++ b/views/page.tpl @@ -5,17 +5,17 @@ % else: {{!page.render()}} <hr> - <p> + <p>Last edited {{page.updated_at}}</p> + <nav> % if not page.history: <a href="/edit/{{page.name}}">Edit</a> % end - : <a href="/history/{{page.name}}">History</a> + <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> + <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> + </nav> % end % include('footer.tpl') @@ -31,7 +31,7 @@ if DEV: # check two words pascal case -app.router.add_filter('pc', lambda conf: (r'[A-Z][a-z]+[A-Z][a-z]*', None, None)) +app.router.add_filter("pc", lambda conf: (r"[A-Z][a-z]+[A-Z][a-z]*", None, None)) @app.route("/") @@ -75,7 +75,7 @@ def edit_save(db, name): page = model.get_page(db, name) if page.version is not None: - page.updated_at = datetime.utcnow() + page.updated_at = model.Page.now() page.content = request.forms.get("content") page.changelog = request.forms.get("changelog") page.version = md5(str(page.updated_at).encode()).hexdigest() |