From b77700f2dfe4ad0e1793cf8b856ecc06dd2dee6c Mon Sep 17 00:00:00 2001 From: chimchooree Date: Thu, 1 Oct 2020 17:51:46 -0500 Subject: [PATCH] added diary navigation to the diary template; moved diary directory on top of directory row --- src/index.py | 29 +++++++++++++++++++++++++++-- src/views/diary.tpl | 4 +++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/index.py b/src/index.py index e76702b..f68c88e 100644 --- a/src/index.py +++ b/src/index.py @@ -7,7 +7,32 @@ from bottle import error, route, run, static_file, template # write diary def build_nav(): - return "nav" + nav = "nav" + return nav + +#function build_nav($page, $total) { + # echo '
'; + + # $limit = 4; + + # $min = max($page - $limit, 0); + #$max = min($page + $limit, $total); +# if($min > 0) { + # echo "first"; + # } + # for($i = $min; $i < $max; $i++) { + # if ($i == $page) { + # echo "$i"; + # } else { + # echo "$i"; + #} +# } + # if($max < $total) { + # $t = $total - 1; + # echo "last"; + #} +# echo '
'; +#} def make_latest(): # for article in array (just 5 or something) @@ -120,7 +145,7 @@ def presskit(): @route('/diary') def diary(): """diary page""" - info = {'css': 'diary', 'title': 'blessfrey - about the game', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest()} + info = {'css': 'diary', 'title': 'blessfrey - about the game', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest(), 'nav': build_nav()} return template('diary.tpl', info) if __name__ == '__main__': diff --git a/src/views/diary.tpl b/src/views/diary.tpl index 2329bc9..80d0e0a 100644 --- a/src/views/diary.tpl +++ b/src/views/diary.tpl @@ -1,7 +1,9 @@ % rebase('frame.tpl') -
+
+ {{nav}} +