Update UI for the file/media app

pull/1/head
yflory 8 years ago
parent c2c04bd5d8
commit cbe21959b4

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

@ -3,6 +3,19 @@ body {
margin: 0px; margin: 0px;
height: 100%; 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 { .cryptpad-toolbar {
margin-bottom: 1px; margin-bottom: 1px;
padding: 0px; padding: 0px;
@ -23,6 +36,10 @@ body {
position: absolute; position: absolute;
z-index: -1; z-index: -1;
} }
media-tag img {
max-width: 100%;
max-height: calc(100vh - 64px);
}
#upload-form, #upload-form,
#download-form { #download-form {
padding: 0px; padding: 0px;
@ -56,20 +73,14 @@ body {
display: none; display: none;
} }
.inputfile + label { .inputfile + label {
border: 2px solid black;
background-color: rgba(50, 50, 50, 0.1);
display: block; display: block;
} }
.inputfile:focus + label,
.inputfile + label:hover {
background-color: rgba(50, 50, 50, 0.3);
}
#progress { #progress {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
height: 100%; height: 100%;
transition: width 500ms; transition: width 200ms;
width: 0%; width: 0%;
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
@ -77,3 +88,9 @@ body {
z-index: 10000; z-index: 10000;
display: block; display: block;
} }
body #uploadStatusContainer {
background-color: rgba(255, 255, 255, 0.9);
color: black;
opacity: 0.9;
display: block !important;
}

@ -7,6 +7,19 @@ html, body {
margin: 0px; margin: 0px;
height: 100%; 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 { .cryptpad-toolbar {
margin-bottom: 1px; margin-bottom: 1px;
padding: 0px; padding: 0px;
@ -28,6 +41,13 @@ html, body {
z-index: -1; z-index: -1;
} }
media-tag {
img {
max-width: 100%;
max-height: ~"calc(100vh - 64px)";
}
}
#upload-form, #download-form { #upload-form, #download-form {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
@ -61,14 +81,14 @@ html, body {
display: none; display: none;
} }
.inputfile + label { .inputfile + label {
border: 2px solid black; //border: 2px solid black;
background-color: rgba(50, 50, 50, .10); //background-color: rgba(50, 50, 50, .10);
display: block; display: block;
} }
.inputfile:focus + label, .inputfile:focus + label,
.inputfile + label:hover { .inputfile + label:hover {
background-color: rgba(50, 50, 50, 0.30); //background-color: rgba(50, 50, 50, 0.30);
} }
#progress { #progress {
@ -78,7 +98,7 @@ html, body {
height: 100%; height: 100%;
transition: width 500ms; transition: width 200ms;
width: 0%; width: 0%;
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
@ -87,3 +107,9 @@ html, body {
display: block; display: block;
} }
body #uploadStatusContainer {
background-color: rgba(255, 255, 255, 0.9);
color: black;
opacity: 0.9;
display: block !important;
}

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

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

Loading…
Cancel
Save