]> git.ipfire.org Git - ipfire.org.git/blob - src/templates/docs/files/detail.html
docs: Show where an image is being used
[ipfire.org.git] / src / templates / docs / files / detail.html
1 {% extends "../page.html" %}
2
3 {% block title %}{{ file.filename }}{% end block %}
4
5 {% block head %}{% end block %}
6
7 {% block main %}
8 <section class="section">
9 <div class="container">
10 {% if file.is_image() %}
11 <div class="block">
12 <div class="notification">
13 <figure class="image">
14 <img src="{{ file.url }}?revision={{ file.created_at.isoformat() }}&s=1920" alt="{{ file.filename }}">
15 </figure>
16 </div>
17 </div>
18 {% elif file.is_pdf() %}
19 <div class="block">
20 <object class="pdf-viewer" data="{{ file.url }}?revision={{ file.created_at.isoformat() }}"
21 title="{{ file.filename }}" type="{{ file.mimetype }}">
22 <p>
23 {{ _("This PDF attachment could not be displayed.") }}
24 <a href="{{ file.url }}?revision={{ file.created_at.isoformat() }}">{{ _("Click here to download") }}</a>
25 </p>
26 </object>
27 </div>
28 {% end %}
29
30 <div class="block">
31 <a class="button is-primary is-fullwidth" href="{{ file.url }}?revision={{ file.created_at.isoformat() }}">
32 <span class="icon">
33 <i class="fas fa-file-download"></i>
34 </span>
35 <span>{{ _("Download") }} ({{ format_size(file.size) }})</span>
36 </a>
37 </div>
38 </div>
39 </section>
40
41 <section class="section">
42 <div class="container">
43 {% if file.is_image() %}
44 <h5 class="title is-5">{{ _("Usage") }}</h6>
45
46 <div class="block">
47 <pre><code>![](./{{ file.filename }})</code></pre>
48 </div>
49
50 <h6 class="title is-6">{{ _("Or with an optional caption") }}</h6>
51
52 <div class="block">
53 <pre><code>![](./{{ file.filename }} "{{ _("Caption") }}")</code></pre>
54 </div>
55 {% end %}
56
57 <h5 class="title is-5">{{ _("Details") }}</h5>
58
59 <table class="table is-fullwidth">
60 <tr>
61 <th scope="row">
62 {{ _("Filename") }}
63 </th>
64 <td>
65 <code>{{ file.filename }}</code>
66 </td>
67 </tr>
68
69 {% if file.author %}
70 <tr>
71 <th scope="row">
72 {{ _("Author") }}
73 </th>
74 <td>
75 <a href="/users/{{ file.author.uid }}">{{ file.author }}</a>
76 </td>
77 </tr>
78 {% end %}
79
80 <tr>
81 <th scope="row">
82 {{ _("Uploaded at") }}
83 </th>
84 <td>
85 {{ locale.format_date(file.created_at) }}
86 </td>
87 </tr>
88
89 {% if file.deleted_at %}
90 <tr>
91 <th scope="row">
92 {{ _("Deleted at") }}
93 </th>
94 <td>
95 {{ locale.format_date(file.deleted_at) }}
96 </td>
97 </tr>
98 {% end %}
99
100 {% set revisions = file.get_revisions() %}
101 {% if len(revisions) > 1 %}
102 {% for i, r in enumerate(revisions) %}
103 <tr>
104 {% if i == 0 %}
105 <th scope="row">{{ _("Other Revisions") }}</th>
106 {% else %}
107 <td></td>
108 {% end %}
109
110 <td>
111 <a href="{{ r.url }}?action=detail&revision={{ r.created_at.isoformat() }}">
112 {{ _("Uploaded %(time)s by %(author)s") % { "time" : locale.format_date(r.created_at), "author" : r.author } }}
113 </a>
114 </td>
115 </tr>
116 {% end %}
117 {% end %}
118 </table>
119 </div>
120 </section>
121
122 <section class="section">
123 <div class="container">
124 {% if file.pages %}
125 <h6 class="title is-6">{{ _("Used By") }}</h6>
126
127 <div class="block">
128 <ul>
129 {% for page in file.pages %}
130 <li>
131 <a href="{{ page.url }}">
132 {% for p, b in page.breadcrumbs %}
133 {{ b }} /
134 {% end %}
135
136 {{ page.title }}
137 </a>
138 </li>
139 {% end %}
140 </ul>
141 </div>
142 {% end %}
143
144 <h6 class="title is-6">{{ _("Delete") }}</h6>
145
146 <div class="block">
147 <a class="button is-danger" href="{{ file.url }}/_delete" {% if not file.can_be_deleted() %}disabled{% end %}>
148 {{ _("Delete") }}
149 </a>
150 </div>
151
152 <h6 class="title is-6">{{ _("Upload Newer Revision") }}</h6>
153
154 <form method="POST" action="/docs/_upload" enctype="multipart/form-data">
155 {% raw xsrf_form_html() %}
156
157 <input type="hidden" name="path" value="{{ file.path }}">
158 <input type="hidden" name="filename" value="{{ file.filename }}">
159
160 <div class="field">
161 <div class="control">
162 <div class="file is-boxed">
163 <label class="file-label">
164 <input class="file-input" type="file" name="file">
165 <span class="file-cta">
166 <span class="file-icon">
167 <i class="fas fa-upload"></i>
168 </span>
169 <span class="file-label">
170 {{ _("Choose a file to upload") }}
171 </span>
172 </span>
173 </label>
174 </div>
175 </div>
176
177 <p class="help">
178 {{ _("Uploading a new file to replaces this one to fix any errata in the current version") }}
179 </p>
180 </div>
181
182 <div class="field">
183 <div class="control">
184 <input class="button is-primary" type="submit" value="{{ _("Upload") }}">
185 </div>
186 </div>
187 </form>
188 </div>
189 </div>
190 {% end block %}