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