]> git.ipfire.org Git - ipfire.org.git/blame - src/templates/wiki/files/detail.html
wiki: Allow uploading newer revisions of a file
[ipfire.org.git] / src / templates / wiki / files / detail.html
CommitLineData
531846f7 1{% extends "../page.html" %}
8cb0bea4
MT
2
3{% block title %}{{ file.filename }}{% end block %}
4
5{% block main %}
6 <div class="card mb-4">
7 <div class="card-body">
8 {% if file.is_image() %}
acc2b3b6 9 <p class="text-center">
ff14dea3 10 <img class="img-fluid img-thumbnail" src="{{ file.url }}?revision={{ file.created_at.isoformat() }}&s=768" alt="{{ file.filename }}">
acc2b3b6 11 </p>
8cb0bea4 12 {% elif file.is_pdf() %}
ff14dea3 13 <object class="pdf-viewer" data="{{ file.url }}?revision={{ file.created_at.isoformat() }}"
8cb0bea4
MT
14 title="{{ file.filename }}" type="{{ file.mimetype }}">
15 <p>
16 {{ _("This PDF attachment could not be displayed.") }}
ff14dea3 17 <a href="{{ file.url }}?revision={{ file.created_at.isoformat() }}">{{ _("Click here to download") }}</a>
8cb0bea4
MT
18 </p>
19 </object>
20 {% end %}
21
ff14dea3 22 <a class="btn btn-primary btn-lg btn-block my-3" href="{{ file.url }}?revision={{ file.created_at.isoformat() }}">
8cb0bea4
MT
23 <span class="fas fa-file-download"></span>
24 {{ _("Download") }} ({{ format_size(file.size) }})
25 </a>
26
75271a43 27 <dl class="row">
8cb0bea4
MT
28 <dt class="col-sm-3">{{ _("Filename") }}</dt>
29 <dd class="col-sm-9">{{ file.filename }}</dd>
30
31 {% if file.author %}
32 <dt class="col-sm-3">{{ _("Author") }}</dt>
33 <dd class="col-sm-9">
34 <a href="/users/{{ file.author.uid }}">{{ file.author }}</a>
35 </dd>
36 {% end %}
37
38 <dt class="col-sm-3">{{ _("Uploaded at") }}</dt>
39 <dd class="col-sm-9">{{ locale.format_date(file.created_at) }}</dd>
ff14dea3
MT
40
41 {% if file.deleted_at %}
42 <dt class="col-sm-3">{{ _("Deleted at") }}</dt>
43 <dd class="col-sm-9">{{ locale.format_date(file.deleted_at) }}</dd>
44 {% end %}
8cb0bea4 45 </dl>
75271a43
MT
46
47 {% if file.is_image() %}
48 <h6>{{ _("Usage") }}</h6>
49
ccb3e29b 50 <pre><code>![](./{{ file.filename }})</code></pre>
c78ad26e
MT
51
52 <p>{{ _("Or with an optional caption") }}</p>
53
ccb3e29b 54 <pre><code>![](./{{ file.filename }} "{{ _("Caption") }}")</code></pre>
75271a43 55 {% end %}
ff14dea3
MT
56
57 {% set revisions = file.get_revisions() %}
58 {% if len(revisions) > 1 %}
59 <h6>{{ _("Other Revisions") }}</h6>
60
61 <ul>
62 {% for r in revisions %}
63 {% if not file == r %}
64 <li>
65 <a href="{{ r.url }}?action=detail&revision={{ r.created_at.isoformat() }}">
66 {{ _("Uploaded %(time)s by %(author)s") % { "time" : locale.format_date(r.created_at), "author" : r.author } }}
67 </a>
68 </li>
69 {% end %}
70 {% end %}
71 </ul>
72 {% end %}
73
74 <form method="POST" action="/actions/upload" enctype="multipart/form-data">
75 {% raw xsrf_form_html() %}
76
77 <input type="hidden" name="path" value="{{ file.path }}">
78 <input type="hidden" name="filename" value="{{ file.filename }}">
79
80 <div class="form-group">
81 <div class="custom-file">
82 <input type="file" class="custom-file-input" name="file" required>
83 <label class="custom-file-label" for="customFile">{{ _("Choose a file to upload") }}</label>
84 </div>
85 </div>
86
87 <input class="btn btn-primary btn-block" type="submit" value="{{ _("Upload") }}">
88 </form>
8cb0bea4
MT
89 </div>
90 </div>
91{% end block %}