forked from edgewall/trac
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jlist_of_attachments.html
102 lines (91 loc) · 3.18 KB
/
jlist_of_attachments.html
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
97
98
99
100
101
102
{# Copyright (C) 2010-2014 Edgewall Software
This software is licensed as described in the file COPYING, which
you should have received as part of this distribution. The terms
are also available at http://trac.edgewall.com/license.html.
This software consists of voluntary contributions made by many
individuals. For the exact contribution history, see the revision
history and logs, available at http://trac.edgewall.org/.
#}
## Displays a list of attachments.
{# Arguments:
- alist: the data for the list of attachments
- compact=False: if True, show the list in compact format (e.g. as used in the wiki view)
- add_button_title=None: the title of the "Attach" button
- foldable=False: if True, make the list of attachments foldable
#}
# macro show_one_attachment(attachment)
# set attachment_links
<a href="${url_of(attachment.resource)}" title="${_("View attachment")}">${
attachment.filename
}</a><a href="${url_of(attachment.resource, format='raw')}"
class="trac-rawlink" title="${_("Download")}">​</a>
# endset
# with
# set size = pretty_size(attachment.size)
# set author = authorinfo(attachment.author)
# set date = pretty_dateinfo(attachment.date)
# set title = _('%(size)s bytes', size=attachment.size)
# trans attachment_links = attachment_links, size, author, date, title
${attachment_links}(<span title="${title}">${size}</span>)
- added by ${author} ${date}.
# endtrans
# endwith
# endmacro
# with
# set compact = compact|default(false)
# set add_button_title = add_button_title|default(none)
# set foldable = foldable|default(false)
# set download_all_as_zip
<p>
${_("Download all attachments as:")}
<a rel="nofollow" href="${alist.download_href}">.zip</a>
</p>
# endset
# if alist.attachments or alist.can_create:
<div id="attachments">
# if compact and alist.attachments:
<h3 ${{'class': 'foldable' if foldable}|htmlattr}>
${_("Attachments")}
<span class="trac-count">(${len(alist.attachments)})</span></h3>
<div>
<ul>
# for attachment in alist.attachments:
<li>
${show_one_attachment(attachment)}
# if compact and attachment.description:
<q>${wiki_to_oneliner(context, attachment.description)}</q>
# endif
</li>
# endfor
</ul>
# if alist.download_href:
${ download_all_as_zip|safe }
# endif
</div>
# elif not compact:
<h3 ${{'class': 'foldable' if foldable}|htmlattr}>
${_("Attachments")}
<span class="trac-count">(${len(alist.attachments)})</span></h3>
# if alist.attachments or alist.can_create:
<div class="attachments">
# if alist.attachments:
<dl class="attachments">
# for attachment in alist.attachments:
<dt>${show_one_attachment(attachment)}</dt>
# if attachment.description:
<dd>${wiki_to_oneliner(context, attachment.description)}</dd>
# endif
# endfor
</dl>
# endif
# if alist.attachments and alist.download_href:
${ download_all_as_zip|safe }
# endif
# include "jattach_file_form.html"
</div>
# endif
# endif
</div>
# endif
# endwith
## jinjacheck: "got (a a CDATA span CDATA p div )" OK