Commit | Line | Data |
---|---|---|
a80ebf3b AL |
1 | {# |
2 | # GNU MediaGoblin -- federated, autonomous media hosting | |
3 | # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. | |
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License as published by | |
7 | # the Free Software Foundation, either version 3 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU Affero General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU Affero General Public License | |
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | #} | |
18 | ||
19 | {% extends 'mediagoblin/user_pages/media.html' %} | |
20 | ||
21 | {% set medium_view = request.app.public_store.file_url( | |
22 | media.media_files['medium']) %} | |
23 | ||
24 | {% if 'pdf' in media.media_files %} | |
25 | {% set pdf_view = request.app.public_store.file_url( | |
26 | media.media_files['pdf']) %} | |
27 | {% else %} | |
28 | {% set pdf_view = request.app.public_store.file_url( | |
29 | media.media_files['original']) %} | |
30 | {% endif %} | |
31 | ||
3f595184 | 32 | {% set pdf_js = global_config['plugins'].get('mediagoblin.media_types.pdf', {}).get('pdf_js', False) %} |
a80ebf3b AL |
33 | |
34 | {% if pdf_js %} | |
35 | {% block mediagoblin_html_tag %} | |
36 | dir="ltr" mozdisallowselectionprint moznomarginboxes | |
37 | {% endblock mediagoblin_html_tag %} | |
38 | {% endif %} | |
39 | ||
40 | {% block mediagoblin_head -%} | |
41 | {{ super() }} | |
42 | ||
43 | <meta charset="utf-8"> | |
44 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
45 | ||
a80ebf3b AL |
46 | {%- endblock %} |
47 | ||
48 | {% block mediagoblin_media %} | |
03ff0b36 | 49 | <div class="media_other_container"> |
50 | {% if pdf_js %} | |
51 | <iframe width="640px" height="480px" | |
52 | src="{{ request.staticdirect('/extlib/pdf.js/web/viewer.html') }}?file={{ pdf_view }} "> | |
53 | </iframe> | |
54 | {% else %} | |
55 | <a href="{{ pdf_view }}"> | |
56 | <img id="medium" | |
57 | class="media_image" | |
58 | src="{{ medium_view }}" | |
59 | alt=" | |
60 | {%- trans media_title=media.title -%} | |
61 | Image for {{ media_title}} | |
62 | {%- endtrans %}"/> | |
63 | </a> | |
64 | {% endif %} | |
65 | </div> | |
a80ebf3b AL |
66 | {% endblock %} |
67 | ||
68 | {% block mediagoblin_sidebar %} | |
69 | <h3>{% trans %}Download{% endtrans %}</h3> | |
70 | <ul> | |
71 | {% if 'original' in media.media_files %} | |
72 | <li> | |
73 | <a href="{{ request.app.public_store.file_url( | |
74 | media.media_files.original) }}"> | |
75 | {%- trans %}Original file{% endtrans -%} | |
76 | </a> | |
77 | </li> | |
78 | {% endif %} | |
79 | {% if 'pdf' in media.media_files %} | |
80 | <li> | |
81 | <a href="{{ request.app.public_store.file_url( | |
82 | media.media_files.pdf) }}"> | |
83 | {%- trans %}PDF file{% endtrans -%} | |
84 | </a> | |
85 | </li> | |
86 | {% endif %} | |
87 | </ul> | |
88 | {% endblock %} |