]> source.dussan.org Git - nextcloud-server.git/commitdiff
automatically hide show/hide the empty folder message
authorRobin Appelman <icewind1991@gmail.com>
Sat, 30 Jul 2011 12:42:58 +0000 (14:42 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Sat, 30 Jul 2011 12:44:22 +0000 (14:44 +0200)
files/css/files.css
files/js/filelist.js
files/js/files.js
files/templates/part.list.php

index 578d5df174bd03da4b2f85888d685aecc670fa6f..c81960f5e488b09aaa6dcc6bdfe4d08b3e7f9972 100644 (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; }
index c3a2522fb6a165d9abd86da594e0736bb6152e3b..862fb1797a6dc316556a20e3458bf3ac72460e91 100644 (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);
index d3f91fe9a2f3b94beb627f2ecb9c127379e64c2f..7005502d942397ecf7f7e76a0aca2f095786d8d7 100644 (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
index 40586664328ffa6a3e0fe3233f5440de3cb1ef2c..8f55440fe48dbc53c43e88bf360cb440fdf0f9f0 100644 (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;