Commit | Line | Data |
---|---|---|
62cc81fb AN |
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 | ||
22 | {% block mediagoblin_media %} | |
23 | ||
24 | ||
418d1b14 | 25 | {% set model_download = request.app.public_store.file_url( |
ddbf6af1 | 26 | media.media_files['original']) %} |
418d1b14 AN |
27 | {% set perspective_view = request.app.public_store.file_url( |
28 | media.media_files['perspective']) %} | |
29 | {% set top_view = request.app.public_store.file_url( | |
30 | media.media_files['top']) %} | |
31 | {% set side_view = request.app.public_store.file_url( | |
32 | media.media_files['side']) %} | |
33 | {% set front_view = request.app.public_store.file_url( | |
34 | media.media_files['front']) %} | |
35 | ||
36 | <style type="text/css"> | |
37 | #top_view, #side_view, #front_view, #thingy_view { | |
38 | display: none; | |
39 | } | |
ee3f8768 AN |
40 | .media_image { |
41 | cursor: inherit!important; | |
42 | } | |
43 | ||
418d1b14 | 44 | </style> |
62cc81fb | 45 | |
ee3f8768 | 46 | {% if media.media_data.file_type == "stl" %} |
78d932e7 CAW |
47 | <script src="{{ request.staticdirect('/js/extlib/thingiview.js/Three.js') }}"></script> |
48 | <script src="{{ request.staticdirect('/js/extlib/thingiview.js/plane.js') }}"></script> | |
49 | <script src="{{ request.staticdirect('/js/extlib/thingiview.js/thingiview.js') }}"></script> | |
ee3f8768 | 50 | {% endif %} |
62cc81fb AN |
51 | |
52 | ||
418d1b14 | 53 | <script type="text/javascript"> |
418d1b14 AN |
54 | window.show = function (view_id) { |
55 | ids = [ | |
56 | "perspective", | |
57 | "top_view", | |
58 | "side_view", | |
59 | "front_view", | |
60 | "thingy_view", | |
61 | ]; | |
62 | for (var i=0; i<ids.length; i+=1) { | |
63 | id = ids[i]; | |
64 | var view = document.getElementById(id); | |
65 | view.style.display = id===view_id ? "block" : "none"; | |
66 | } | |
67 | }; | |
68 | ||
69 | window.show_things = function () { | |
70 | document.getElementById("webgl_button").onclick = function () { | |
71 | show('thingy_view'); | |
72 | }; | |
73 | window.show("thingy_view"); | |
78d932e7 | 74 | thingiurlbase = "{{ request.staticdirect('/js/extlib/thingiview.js') }}"; |
418d1b14 | 75 | thingiview = new Thingiview("thingy_view"); |
6645c458 AN |
76 | thingiview.setObjectColor('#821543'); |
77 | thingiview.initScene(); | |
418d1b14 | 78 | thingiview.loadSTL("{{ model_download }}"); |
6645c458 | 79 | thingiview.setRotation(false); |
418d1b14 | 80 | }; |
62cc81fb AN |
81 | </script> |
82 | ||
f6e9aa8a CAW |
83 | <div class="media_pane eleven columns"> |
84 | <div class="media_image_container"> | |
85 | ||
418d1b14 AN |
86 | <img |
87 | id="perspective" | |
88 | class="media_image" | |
89 | src="{{ perspective_view }}" | |
90 | alt="{% trans media_title=media.title -%} | |
91 | Image for {{ media_title }}{% endtrans %}" /> | |
92 | <img | |
93 | id="top_view" | |
94 | class="media_image" | |
95 | src="{{ top_view }}" | |
96 | alt="{% trans media_title=media.title -%} | |
97 | Image for {{ media_title }}{% endtrans %}" /> | |
98 | <img | |
99 | id="side_view" | |
100 | class="media_image" | |
101 | src="{{ side_view }}" | |
102 | alt="{% trans media_title=media.title -%} | |
103 | Image for {{ media_title }}{% endtrans %}" /> | |
104 | <img | |
105 | id="front_view" | |
106 | class="media_image" | |
107 | src="{{ front_view }}" | |
108 | alt="{% trans media_title=media.title -%} | |
109 | Image for {{ media_title }}{% endtrans %}" /> | |
03ff0b36 | 110 | <!--<div id="thingy_view" style="width:640px;height:640px;"></div>--> |
111 | <div id="thingy_view"></div> | |
418d1b14 | 112 | |
f6e9aa8a | 113 | </div> |
418d1b14 AN |
114 | |
115 | <div style="padding: 4px;"> | |
ac08a9ac | 116 | <a class="button_action" onclick="show('perspective');"> |
418d1b14 AN |
117 | {%- trans %}Perspective{% endtrans -%} |
118 | </a> | |
ac08a9ac | 119 | <a class="button_action" onclick="show('front_view');"> |
418d1b14 | 120 | {%- trans %}Front{% endtrans -%} |
6645c458 | 121 | </a> |
ac08a9ac | 122 | <a class="button_action" onclick="show('top_view');"> |
418d1b14 AN |
123 | {%- trans %}Top{% endtrans -%} |
124 | </a> | |
ac08a9ac | 125 | <a class="button_action" onclick="show('side_view');"> |
418d1b14 AN |
126 | {%- trans %}Side{% endtrans -%} |
127 | </a> | |
d93eac36 | 128 | {% if media.media_data.file_type == "stl" %} |
418d1b14 | 129 | <a id="webgl_button" class="button_action" |
ac08a9ac | 130 | onclick="show_things();"> |
418d1b14 | 131 | {%- trans %}WebGL{% endtrans -%} |
6645c458 | 132 | </a> |
d93eac36 | 133 | {% endif %} |
418d1b14 AN |
134 | |
135 | <a class="button_action" href="{{ model_download }}" | |
418d1b14 AN |
136 | style="float:right;"> |
137 | {%- trans %}Download model{% endtrans -%} | |
138 | </a> | |
139 | </div> | |
62cc81fb | 140 | |
f6e9aa8a | 141 | </div> |
62cc81fb AN |
142 | |
143 | {% endblock %} | |
144 | ||
145 | {% block mediagoblin_sidebar %} | |
6fbde773 AN |
146 | <h3>{% trans %}File Format{% endtrans %}</h3> |
147 | <p>{{ media.media_data.file_type }}</p> | |
148 | <h3>{% trans %}Object Height{% endtrans %}</h3> | |
149 | <p>~{{ media.media_data.height|int }} mm</p> | |
dedebd48 | 150 | {% template_hook("stl_sideinfo") %} |
62cc81fb | 151 | {% endblock %} |