|
@@ -101,121 +101,37 @@
|
101
|
101
|
|
102
|
102
|
<div class="content__detail file">
|
103
|
103
|
<% download_url = tg.url('/workspaces/{}/folders/{}/files/{}/download?revision_id={}'.format(result.file.workspace.id, result.file.parent.id,result.file.id,result.file.selected_revision)) %>
|
104
|
|
- <div class="t-half-spacer-above download-file-button">
|
105
|
|
- <a style="" class="btn btn-default" tittle="${_('Download the file')}"
|
106
|
|
- href="${download_url}" >
|
107
|
|
- ${ICON.FA_FW('fa fa-download fa-2x')}
|
108
|
|
- </a>
|
109
|
|
- </div>
|
110
|
|
-
|
111
|
104
|
<div class="t-half-spacer-above">
|
112
|
|
- <table class="table table-hover table-condensed table-striped table-bordered">
|
113
|
|
- <tr>
|
114
|
|
- <td class="tracim-title">${_('Preview')}</td>
|
115
|
|
- <td>
|
116
|
|
- <table>
|
117
|
|
- <tr>
|
118
|
|
- <td>
|
119
|
|
- <button type="button" id="prev" onclick="previous_page()">
|
120
|
|
- <span class="pull-left">
|
121
|
|
- ${ICON.FA_FW('fa fa-chevron-left')}
|
122
|
|
- </span>
|
123
|
|
- </button>
|
124
|
|
- </td>
|
125
|
|
- <td>
|
126
|
|
- <a id="preview_link"><img id='preview' alt="Preview"></a>
|
127
|
|
- </td>
|
128
|
|
- <td>
|
129
|
|
- <button type="button" id="next" onclick="next_page()">
|
130
|
|
- <span>
|
131
|
|
- ${ICON.FA_FW('fa fa-chevron-right')}
|
132
|
|
- </span>
|
133
|
|
- </button>
|
134
|
|
- </td>
|
135
|
|
- <td>
|
136
|
|
- <a type="button" id="dl_one_pdf">${_('this page')}
|
137
|
|
- <span class="pull-left">
|
138
|
|
- ${ICON.FA_FW('fa fa-download')}
|
139
|
|
- </span>
|
140
|
|
- </a>
|
141
|
|
- </td>
|
142
|
|
- <td>
|
143
|
|
- <a type="button" id="dl_full_pdf">${_('all pages')}
|
144
|
|
- <span class="pull-left">
|
145
|
|
- ${ICON.FA_FW('fa fa-download')}
|
146
|
|
- </span>
|
147
|
|
- </a>
|
148
|
|
- </td>
|
149
|
|
- </tr>
|
150
|
|
- </table>
|
151
|
|
-
|
152
|
|
- <script type="text/javascript">
|
153
|
|
- var nb_page = parseInt(${nb_page});
|
154
|
|
- console.log(nb_page);
|
155
|
|
- var page = 0;
|
156
|
|
- var urls = [];
|
157
|
|
- % for one_url in url:
|
158
|
|
- urls.push('${one_url}');
|
159
|
|
- % endfor
|
160
|
|
- console.log(urls);
|
161
|
|
- document.getElementById('preview').src = urls[page];
|
162
|
|
- refresh_button();
|
163
|
|
-
|
164
|
|
- function next_page(){
|
165
|
|
- page = page+1;
|
166
|
|
- console.log('page next');
|
167
|
|
- console.log(urls[page]);
|
168
|
|
- document.getElementById('preview').src = urls[page];
|
169
|
|
- refresh_button();
|
170
|
|
- }
|
171
|
|
-
|
172
|
|
- function previous_page(){
|
173
|
|
- page = page-1;
|
174
|
|
- console.log('page previous');
|
175
|
|
- console.log(urls[page]);
|
176
|
|
- document.getElementById('preview').src = urls[page];
|
177
|
|
- refresh_button();
|
178
|
|
- }
|
179
|
|
-
|
180
|
|
- function refresh_button(){
|
181
|
|
- console.log(page);
|
182
|
|
- document.getElementById('prev').disabled = false;
|
183
|
|
- document.getElementById('next').disabled = false;
|
184
|
|
- document.getElementById('dl_one_pdf').href = "/previews/${result.file.id}/pages/" + page + "/download_pdf_one?revision_id=${result.file.selected_revision}";
|
185
|
|
- document.getElementById('dl_full_pdf').href = "/previews/${result.file.id}/pages/" + page + "/download_pdf_full?revision_id=${result.file.selected_revision}";
|
186
|
|
- document.getElementById('preview_link').href = "/previews/${result.file.id}/pages/" + page + "/high_quality?revision_id=${result.file.selected_revision}";
|
187
|
|
- if(page >= nb_page-1){
|
188
|
|
- document.getElementById('next').disabled = true;
|
189
|
|
- }
|
190
|
|
- if(page <= 0){
|
191
|
|
- document.getElementById('prev').disabled = true;
|
192
|
|
- }
|
193
|
|
- }
|
194
|
|
- </script>
|
195
|
|
- </td>
|
196
|
|
- </tr>
|
197
|
|
- <tr>
|
198
|
|
- <td class="tracim-title">${_('File')}</td>
|
199
|
|
- <td>
|
200
|
|
- <a href="${download_url}" tittle="${_('Download the file (last revision)')}">
|
201
|
|
- ${result.file.file.name}
|
202
|
|
- <span class="pull-right">
|
203
|
|
- ${ICON.FA_FW('fa fa-download')}
|
204
|
|
- </span>
|
205
|
|
-
|
206
|
|
- </a>
|
207
|
|
- </td>
|
208
|
|
- </tr>
|
209
|
|
- <tr>
|
210
|
|
- <td class="tracim-title">${_('Size')}</td>
|
211
|
|
- <td>${h.user_friendly_file_size(result.file.file.size)}</td>
|
212
|
|
- </tr>
|
213
|
|
- <tr>
|
214
|
|
- <td class="tracim-title">${_('Modified')}</td>
|
215
|
|
- <% created_localized = h.get_with_timezone(result.file.created) %>
|
216
|
|
- <td>${h.format_short(created_localized)|n} ${_('by {}').format(result.file.owner.name)}</td>
|
217
|
|
- </tr>
|
218
|
|
- </table>
|
|
105
|
+ <div id='previewGenerator'></div>
|
|
106
|
+ <script src="${tg.url('/assets/js/previewGenerator.vendor.bundle.js')}" type="text/javascript"></script>
|
|
107
|
+ <script src="${tg.url('/assets/js/previewGenerator.app.entry.js')}" type="text/javascript"></script>
|
|
108
|
+ <script type="text/javascript">
|
|
109
|
+ <% created_localized = h.get_with_timezone(result.file.created) %>
|
|
110
|
+ (function initialisePreviewGenerator() {
|
|
111
|
+ previewGenerator(
|
|
112
|
+ document.getElementById('previewGenerator'),
|
|
113
|
+ 'fr_FR',
|
|
114
|
+ [
|
|
115
|
+ % for one_url in url:
|
|
116
|
+ '${one_url}',
|
|
117
|
+ % endfor
|
|
118
|
+ ],
|
|
119
|
+ '${nb_page}',
|
|
120
|
+ '/previews/__FILE_ID__/pages/__CURRENT_PAGE__/__DOWNLOAD_TYPE__?revision_id=__REVISION_ID__',
|
|
121
|
+ {
|
|
122
|
+ id: '${result.file.id}',
|
|
123
|
+ name: '${result.file.file.name}',
|
|
124
|
+ selectedRevision: '${result.file.selected_revision}',
|
|
125
|
+ weight: '${h.user_friendly_file_size(result.file.file.size)}',
|
|
126
|
+ height: '300',
|
|
127
|
+ modifiedAt: '${h.format_short(created_localized)|n}',
|
|
128
|
+ owner: '${result.file.owner.name}',
|
|
129
|
+ sourceLink: '${download_url}',
|
|
130
|
+ pdfAvailable: false // FIXME - Côme - 2017/07/24 - backend should return this information
|
|
131
|
+ }
|
|
132
|
+ )
|
|
133
|
+ })()
|
|
134
|
+ </script>
|
219
|
135
|
</div>
|
220
|
136
|
|
221
|
137
|
<div class="t-half-spacer-above">
|