Update UI for the file/media app

This commit is contained in:
yflory 2017-06-15 15:35:52 +02:00
parent c2c04bd5d8
commit cbe21959b4
5 changed files with 82 additions and 32 deletions

View file

@ -180,6 +180,7 @@ define([
queue.next = function () {
if (queue.queue.length === 0) {
queue.to = window.setTimeout(function () {
if (config.keepTable) { return; }
File.$container.fadeOut();
}, 3000);
return;

View file

@ -3,6 +3,19 @@ body {
margin: 0px;
height: 100%;
}
body {
display: flex;
flex-flow: column;
}
#app {
flex: 1;
background: url('/customize/bg3.jpg') no-repeat center center;
background-size: cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
}
.cryptpad-toolbar {
margin-bottom: 1px;
padding: 0px;
@ -23,6 +36,10 @@ body {
position: absolute;
z-index: -1;
}
media-tag img {
max-width: 100%;
max-height: calc(100vh - 64px);
}
#upload-form,
#download-form {
padding: 0px;
@ -56,20 +73,14 @@ body {
display: none;
}
.inputfile + label {
border: 2px solid black;
background-color: rgba(50, 50, 50, 0.1);
display: block;
}
.inputfile:focus + label,
.inputfile + label:hover {
background-color: rgba(50, 50, 50, 0.3);
}
#progress {
position: absolute;
top: 0;
left: 0;
height: 100%;
transition: width 500ms;
transition: width 200ms;
width: 0%;
max-width: 100%;
max-height: 100%;
@ -77,3 +88,9 @@ body {
z-index: 10000;
display: block;
}
body #uploadStatusContainer {
background-color: rgba(255, 255, 255, 0.9);
color: black;
opacity: 0.9;
display: block !important;
}

View file

@ -7,6 +7,19 @@ html, body {
margin: 0px;
height: 100%;
}
body {
display: flex;
flex-flow: column;
}
#app {
flex: 1;
background: url('/customize/bg3.jpg') no-repeat center center;
background-size: cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
}
.cryptpad-toolbar {
margin-bottom: 1px;
padding: 0px;
@ -28,6 +41,13 @@ html, body {
z-index: -1;
}
media-tag {
img {
max-width: 100%;
max-height: ~"calc(100vh - 64px)";
}
}
#upload-form, #download-form {
padding: 0px;
margin: 0px;
@ -61,14 +81,14 @@ html, body {
display: none;
}
.inputfile + label {
border: 2px solid black;
background-color: rgba(50, 50, 50, .10);
//border: 2px solid black;
//background-color: rgba(50, 50, 50, .10);
display: block;
}
.inputfile:focus + label,
.inputfile + label:hover {
background-color: rgba(50, 50, 50, 0.30);
//background-color: rgba(50, 50, 50, 0.30);
}
#progress {
@ -78,7 +98,7 @@ html, body {
height: 100%;
transition: width 500ms;
transition: width 200ms;
width: 0%;
max-width: 100%;
max-height: 100%;
@ -87,3 +107,9 @@ html, body {
display: block;
}
body #uploadStatusContainer {
background-color: rgba(255, 255, 255, 0.9);
color: black;
opacity: 0.9;
display: block !important;
}

View file

@ -10,21 +10,23 @@
</head>
<body>
<div id="toolbar" class="toolbar-container"></div>
<div id="upload-form" style="display: none;">
<input type="file" name="file" id="file" class="inputfile" />
<label for="file" class="block unselectable" data-localization-title="upload_choose"
data-localization="upload_choose"></label>
</div>
<div id="download-form" style="display: none;">
<input type="button" name="dl" id="dl" class="inputfile" />
<label for="dl" class="block unselectable" data-localization-title="download_button"
data-localization="download_button"></label>
<span class="block" id="progress"></span>
</div>
<div id="download-view" style="display: none;">
<media-tag id="encryptedFile"></media-tag>
</div>
<div id="feedback" class="block hidden">
<div id="app">
<div id="upload-form" style="display: none;">
<input type="file" name="file" id="file" class="inputfile" />
<label for="file" class="btn btn-primary block unselectable" data-localization-title="upload_choose"
data-localization="upload_choose"></label>
</div>
<div id="download-form" style="display: none;">
<input type="button" name="dl" id="dl" class="inputfile" />
<label for="dl" class="btn btn-success block unselectable" data-localization-title="download_button"
data-localization="download_button"></label>
<span class="block" id="progress"></span>
</div>
<div id="download-view" style="display: none;">
<media-tag id="encryptedFile"></media-tag>
</div>
<div id="feedback" class="block hidden">
</div>
</div>
</body>
</html>

View file

@ -21,6 +21,7 @@ define([
var andThen = function () {
var ifrw = $('#pad-iframe')[0].contentWindow;
var $iframe = $('#pad-iframe').contents();
var $appContainer = $iframe.find('#app');
var $form = $iframe.find('#upload-form');
var $dlform = $iframe.find('#download-form');
var $dlview = $iframe.find('#download-view');
@ -116,10 +117,12 @@ define([
if (decrypted.callback) { decrypted.callback(); }
$dlview.show();
$dlform.hide();
if (ev) {
var $dlButton = $dlview.find('media-tag button');
$dlButton.click();
var $dlButton = $dlview.find('media-tag button');
if (ev) { $dlButton.click(); }
if (!$dlButton.length) {
$appContainer.css('background', 'white');
}
$dlButton.addClass('btn btn-success');
Cryptpad.removeLoadingScreen();
})
.on('decryptionError', function (e) {
@ -165,11 +168,11 @@ define([
$dlform.show();
Cryptpad.removeLoadingScreen();
var decrypting = false;
var onClick = function () {
var onClick = function (ev) {
if (decrypting) { return; }
if (myFile) { return void exportFile(); }
decrypting = true;
displayFile();
displayFile(ev);
};
if (sizeMb < 5) { return void onClick(); }
Cryptpad.removeLoadingScreen();
@ -200,7 +203,8 @@ define([
var fmConfig = {
dropArea: $form,
hoverArea: $label,
body: $body
body: $body,
keepTable: true // Don't fadeOut the tbale with the uploaded files
};
var FM = Cryptpad.createFileManager(fmConfig);