author | Tero Marttila <terom@fixme.fi> |
Sun, 14 Jun 2009 16:09:04 +0300 | |
branch | new-exif |
changeset 107 | 2e2ef5c99985 |
parent 100 | 0a093efd410d |
child 119 | e7855eefb4c7 |
permissions | -rw-r--r-- |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
Templates for HTML output |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
import html |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
from html import tags |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
|
78
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
8 |
def link_from (source, target) : |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
Returns a partial a tag linking from the given page to the given page |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
XXX: URLEncode unicode -> str! |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
|
78
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
15 |
return tags.a(href=source.path_to(target)) |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
|
78
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
17 |
def image_link (from_page, image, target) : |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
Link to the given image |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
|
78
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
22 |
return link_from(from_page, target)( |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
tags.img(src=image.path_from(from_page)) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
def image_page (image) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
The per-image view |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
|
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
31 |
return [ |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
tags.div(id_='image')( |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
# title |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
34 |
tags.h1(image.title) if image.title else None, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
36 |
# image-links |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
37 |
tags.p( |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
38 |
# prev thumb |
77
2a53c5ade434
misc. fixes, it runs now, but HTML output is corrupt (no flattening)
Tero Marttila <terom@fixme.fi>
parents:
62
diff
changeset
|
39 |
image_link(image.html, image.prev.thumb, image.prev.html) if image.prev else None, |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
41 |
# preview |
77
2a53c5ade434
misc. fixes, it runs now, but HTML output is corrupt (no flattening)
Tero Marttila <terom@fixme.fi>
parents:
62
diff
changeset
|
42 |
image_link(image.html, image.preview, image), |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
43 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
# next thumb |
77
2a53c5ade434
misc. fixes, it runs now, but HTML output is corrupt (no flattening)
Tero Marttila <terom@fixme.fi>
parents:
62
diff
changeset
|
45 |
image_link(image.html, image.next.thumb, image.next.html) if image.next else None |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
46 |
), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
47 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
# optional description |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
49 |
tags.p(image.description) if image.description else None, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
50 |
), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
51 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
52 |
# extended info, metadata |
78
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
53 |
tags.div(id_='info')(*( |
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
54 |
tags.p(("%s: " % name), value) for name, value in image.metadata.iteritems() |
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
55 |
)), |
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
56 |
] |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
57 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
58 |
def folder_link (from_page, folder, page=0) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
60 |
Returns a link to the given folder from the given page |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
61 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
62 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
63 |
return link_from(from_page, folder.html_file(page))(folder.title) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
64 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
65 |
def folder_page_link (folder, page) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
66 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
67 |
Returns a partial a tag from the folder itself to the given page number |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
68 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
69 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
70 |
return link_from(folder, folder.html_file(page)) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
71 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
72 |
def folder_paginate (folder, cur_page) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
73 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
74 |
Render the pagination view for a folder, if needed |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
75 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
76 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
77 |
if folder.page_count > 1 : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
78 |
return tags.div(class_='paginate')( |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
79 |
tags.ul( |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
80 |
# prev link |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
81 |
tags.li(folder_page_link(folder, cur_page - 1)(html.raw("« Prev"))) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
82 |
if cur_page > 0 else |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
83 |
tags.li(tags.span(html.raw("« Prev"))), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
84 |
|
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
85 |
(( |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
86 |
# page link |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
87 |
tags.li(folder_page_link(folder, page)(page + 1)) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
88 |
if page != cur_page else |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
89 |
tags.li(tags.strong(page + 1)) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
90 |
) for page in xrange(folder.page_count)), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
91 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
92 |
# next link |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
93 |
tags.li(folder_page_link(folder, cur_page + 1)(html.raw("» Next"))) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
94 |
if cur_page < folder.page_count - 1 else |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
95 |
tags.li(tags.span(html.raw("» Next"))), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
96 |
) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
97 |
) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
98 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
99 |
def folder_page (folder, cur_page) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
100 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
101 |
Render the per-Folder view for the given page |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
102 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
103 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
104 |
# render the paginate-view once |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
105 |
paginate = folder_paginate(folder, cur_page) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
106 |
|
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
107 |
return [ |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
108 |
# title |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
109 |
tags.h1(folder.title) if folder.title else None, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
110 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
111 |
# subdirs |
100 | 112 |
tags.div(id='dirs')( |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
113 |
tags.ul( |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
114 |
tags.li( |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
115 |
folder_link(folder, subfolder) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
116 |
) for subfolder in folder.subfolders |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
117 |
) if folder.subfolders else None |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
118 |
), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
119 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
120 |
# upper paginate |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
121 |
paginate, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
122 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
123 |
# image thumbnails |
100 | 124 |
tags.div(id='thumbnails')( |
125 |
image_link(folder, image.thumb, image.html) for image in folder.images_for_page(cur_page) |
|
126 |
), |
|
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
127 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
128 |
# lower paginate |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
129 |
paginate, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
130 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
131 |
# description |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
132 |
tags.p(id='description')(folder.description) if folder.description else None, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
133 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
134 |
# shorturl |
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
135 |
] |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
136 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
137 |
def breadcrumb_trail (gallery, page) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
138 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
139 |
Yield the breadcrumb elements |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
140 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
141 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
142 |
is_first = True |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
143 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
144 |
for segment in gallery.path_to(page) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
145 |
# spacers |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
146 |
if is_first : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
147 |
is_first = False |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
148 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
149 |
else : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
150 |
yield html.raw("»") |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
151 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
152 |
# link from this page to sub-page |
78
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
153 |
# XXX: title |
d580323b4bfa
fix html/templates to use a Container type (inherited by Tag) for flat lists of tags
Tero Marttila <terom@fixme.fi>
parents:
77
diff
changeset
|
154 |
yield link_from(page, segment)(segment.name.title()) |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
155 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
156 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
157 |
def breadcrumb (gallery, page) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
158 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
159 |
Build a breadcrumb trail from the gallery root to the given object |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
160 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
161 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
162 |
return tags.div(id='breadcrumb')( |
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
163 |
breadcrumb_trail(gallery, page) |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
164 |
) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
165 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
166 |
def master (gallery, title, page, body) : |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
167 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
168 |
Render the full-page HTML layout for the given page with title and body |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
169 |
""" |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
170 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
171 |
return html.XHTMLDocument( |
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
172 |
head=[ |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
173 |
tags.title(title), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
174 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
175 |
# stylesheet |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
176 |
tags.link(rel='Stylesheet', type='text/css', href=gallery.stylesheet.path_from(page)) |
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
177 |
], |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
178 |
|
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
179 |
body=[ |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
180 |
# top-of-page breadcrumb nav |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
181 |
breadcrumb(gallery, page), |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
182 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
183 |
# other content |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
184 |
body, |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
185 |
|
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
186 |
# footer |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
187 |
tags.p(id='about')(tags.a(href='http://projects.qmsk.net/degal')('Degal'), gallery.version) |
80
f4b637ae775c
fix html to have a separate Container type, but also special-case tuples, lists and genexps
Tero Marttila <terom@fixme.fi>
parents:
78
diff
changeset
|
188 |
], |
62
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
189 |
) |
53e798708413
write new templates using html, replacing old mako stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
190 |