lufi/themes/default/templates/render.html.ep

117 lines
4.4 KiB
Plaintext
Executable File

<section class="download-section">
% if (!defined(stash('f')) && defined(stash('msg'))) {
<article class="message-card error">
<%= stash('msg')%>
</article>
% } else {
<h1 class="title-filename"><%= stash('f')->filename %></h1>
% if (defined(stash('msg'))) {
<article class="message-card error">
<%= stash('msg')%>
</article>
% } else {
% if (stash('file_pwd')) {
<form class="password-form">
<div class="input-text input-password">
<label for="file-password"><%= l('Add a password to file(s)') %></label>
<input type="password" id="file-password" autocomplete="off" autofocus placeholder="<%= l('Password') %>">
</div>
<button type="submit" class="button action-download" href="#"><%= l('Download') %></button>
</form>
% }
<div class="download-container"></div>
<template id="download-card-ongoing">
<article class="download-card ongoing">
<div class="file-description">
<p class="file-size"></p>
</div>
<p class="wait-message"><%= l('Please wait while we are getting your file. We first need to download and decrypt all parts before you can get it.') %></p>
<p class="loading-message"></p>
<div class="progress-container">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<button type="button" class="button action-abort"><%= l('Abort') %></a>
</article>
</template>
<template id="download-card-aborted">
<article class="download-card aborted">
<div class="file-description">
<p class="file-size"></p>
</div>
<p class="abort-message"></p>
<button type="button" class="button action-reload"><%= l('Click here to refresh the page and restart the download.') %></a>
</article>
</template>
<template id="download-card-success">
<article class="download-card success">
<div class="file-description" data-isZipped="<%= (stash('f')->zipped) ? 'true' : 'false' %>">
<p class="file-size"></p>
</div>
<a class="button action-download" autofocus href="#"><%= l('Get the file')%></a>
<div class="content">
<div class="hidden zip-container">
<button type="button" class="button action-show-zip"><%= l('Show zip content') %></button>
<div class="hidden zip-content">
<h2><%= l('Zip content:') %></h2>
<ul>
</ul>
</div>
</div>
</div>
</article>
</template>
<template id="download-card-error">
<article class="download-card error">
<div class="file-description">
<p class="file-name"></p>
<p class="file-size"></p>
</div>
<div class="message-card error"></div>
</article>
</template>
<template id="zip-item">
<li class="zip-item">
<span class="file-name"></span>
<span class="file-size"></span>
<a class="icon-button icon download action-download-item" title="<%= l('Get the file') %>" href="#"></a>
</li>
</template>
% }
% }
</section>
<script type="text/javascript">
const ws_url = '<%= url_for('download')->to_abs().stash('f')->short %>';
const i18n = {
aborted1: '<%= l('Download aborted.') %>',
aborted2: '<%= l('Click here to refresh the page and restart the download.') %>',
badkey: '<%= l('It seems that the key in your URL is incorrect. Please, verify your URL.') %>',
confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>',
download: '<%= l('Get the file') %>',
fileDownloaded: '<%= l('File downloaded') %>',
loading: '<%= l('Asking for file part XX1 of %1', stash('f')->nbslices) %>',
nokey: '<%= l('You don\'t seem to have a key in your URL. You won\'t be able to decrypt the file. Download canceled.') %>',
showZipContent: '<%= l('Show zip content') %>',
tooMuchAttempts: '<%= l('Unable to download the file: too much unsuccessful attempts to open a websocket. Please, contact the administrator.') %>',
zipContent: '<%= l('Zip content:') %>'
}
</script>
%= javascript '/js/lufi-download.js', type => 'module'