forked from bookieio/Bookie
/
func.mako
96 lines (82 loc) · 2.77 KB
/
func.mako
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<%def name="display_bmark_list(bmark_list)">
<%
from datetime import datetime
current_date = datetime(1900, 1, 1).strftime("%m/%d")
last_date = current_date
%>
<div class="yui3-g">
% for bmark in bmark_list:
${bmark_block(bmark, last_date)}
<%
last_date = bmark.stored.strftime("%m/%d")
%>
% endfor
</div>
</%def>
<%def name="bmark_block(bmark, last_date)">
<%
is_new = (last_date != bmark.stored.strftime("%m/%d"))
%>
<div class="yui3-u-1"
% if is_new:
style="border-top: 1px solid #999999;"
% endif
>
<div class="yui3-g bmark">
<div class="yui3-u-1-8">
<div class="center">
% if is_new:
${date_divider(bmark.stored)}
% endif
</div>
</div>
<div class="yui3-u-7-8">
<div class="yui3-g">
<div class="yui3-u-7-8">
<a class="bmark" href="${bmark.url}" title="${bmark.extended}">${bmark.description}</a>
</div>
<div class="yui3-u-1-8">
% if allow_edit:
<span><a href="#">edit</a></span>
<span><a href="${request.route_url('bmark_confirm_delete', bid=bmark.bid)}">delete</a></span>
% endif
</div>
<div class="yui3-u-7-8">
<div class="tags">
% for tag in bmark.tags:
<a class="tag" href="${request.route_url('tag_bmarks', tag=tag, page=prev)}">${tag}</a>
%endfor
</div>
</div>
<div class="yui3-u-1-8">
<div class="bmark time">${bmark.stored.strftime('%H:%M%P')}</div>
</div>
</div>
</div>
</div>
</div>
</%def>
<%def name="date_divider(dateobj)">
<div class="calendar">
<h2>${dateobj.strftime("%b")}</h2>
<div>${dateobj.strftime("%d")}</div>
</div>
</%def>
<%def name="bmarknextprev(page, max_count, count, next_url, url_params=None)">
<%
if max_count == count:
show_next = True
else:
show_next = False
next = page + 1
if url_params is None:
url_params = {}
%>
% if page != 0:
<% prev = page - 1 %>
<a href="${request.route_url(next_url, page=prev, **url_params)}">Prev</a>
% endif
% if show_next:
<a href="${request.route_url(next_url, page=next, **url_params)}">Next</a>
% endif
</%def>