cluster variable is stored in index.py
This commit is contained in:
+1
-1
@@ -121,7 +121,7 @@ def diary2():
|
||||
@route('/diary/<page:int>')
|
||||
def diary(page):
|
||||
"""diary page"""
|
||||
info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest(), 'total': len(gather_files()), 'limit': 3, 'page': page}
|
||||
info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest(), 'total': len(gather_files()), 'limit': 3, 'cluster': 3, 'page': page}
|
||||
return template('diary.tpl', info)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
+1
-4
@@ -4,9 +4,6 @@
|
||||
<div class="diary-dir">
|
||||
<center>
|
||||
% max_pages = int((total - 1) / limit)
|
||||
% cluster = 3
|
||||
% # TRY DECIMAL POINT PAGES
|
||||
|
||||
<%
|
||||
# page never below 0
|
||||
if page <= 0:
|
||||
@@ -31,7 +28,7 @@
|
||||
% # fill out number cluster to the left when page is high
|
||||
% if page > max_pages - cluster:
|
||||
% for j in range(cluster - max_pages + page):
|
||||
<a href=/diary/{{page + j + cluster + 1}}><b><i>{{page + j + cluster + 1}}</b></i></a>
|
||||
<a href=/diary/{{max_pages - cluster * 2 + j}}>{{max_pages - cluster * 2 + j}}</a>
|
||||
% end
|
||||
% end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user