automatically hide show/hide the empty folder message

This commit is contained in:
Robin Appelman 2011-07-30 14:42:58 +02:00
parent 95ec75b919
commit 78d41a03e0
4 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,7 @@
#fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
.file_upload_filename, #file_newfolder_name { background-repeat:no-repeat; background-position:0.5em 0; padding-left:2em; }
.file_upload_filename { background-image:url("../img/file.png"); font-weight:bold; }.file_upload_start { opacity:0;filter:alpha(opacity = 0); }
input.highlight{ background-color:#ffc100; border:#dda600 1px solid; }
#file_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; width:11em; }
.file_upload_start, .file_upload_filename { position:absolute; top:0px; left:0px; width:11em; font-size:0.9em; }

View File

@ -66,6 +66,10 @@ FileList={
remove:function(name){
$('tr[data-file="'+name+'"] td.filename').draggable('destroy');
$('tr[data-file="'+name+'"]').remove();
if($('tr[data-file]').length==0){
$('#emptyfolder').show();
$('.file_upload_filename').addClass('highlight');
}
},
insertElement:function(name,type,element){
//find the correct spot to insert the file or folder
@ -93,6 +97,8 @@ FileList={
}else{
$('#fileList').append(element);
}
$('#emptyfolder').hide();
$('.file_upload_filename').removeClass('highlight');
},
loadingDone:function(name){
$('tr[data-file="'+name+'"]').data('loading',false);

View File

@ -1,4 +1,8 @@
$(document).ready(function() {
if($('tr[data-file]').length==0){
$('.file_upload_filename').addClass('highlight');
}
$('#file_action_panel').attr('activeAction', false);
//drag/drop of files

View File

@ -1,5 +1,5 @@
<?php if(!$_['files']) echo '<span id="emptyfolder">Nothing in here. Upload something!<style>.file_upload_filename { background-color:#ffc100; border:#dda600 1px solid; }</style></span>';
foreach($_['files'] as $file):
<span id="emptyfolder" <?php if(count($_['files'])) echo 'style="display:none;"';?>>Nothing in here. Upload something!</span>
<?php foreach($_['files'] as $file):
$simple_file_size = simple_file_size($file['size']);
$simple_size_color = 200-intval($file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey
if($simple_size_color<0) $simple_size_color = 0;