Browse Source

Added file selection highlight

Stephen Ficklin 6 years ago
parent
commit
3d4a2e4afe
2 changed files with 13 additions and 4 deletions
  1. 2 2
      tripal/includes/tripal.user.inc
  2. 11 2
      tripal/theme/js/tripal.user_files.js

+ 2 - 2
tripal/includes/tripal.user.inc

@@ -106,9 +106,9 @@ function tripal_user_get_files_item_list($files_list, &$i = 0) {
       }
       $expiration = $file->expiration_date ? date('Y-m-d', $file->expiration_date) : '';
       $items[] = [
-        'data' => '<span class="file-name">' . $filename . '</span>' . 
+        'data' => '<span class="file-details"><span class="file-name">' . $filename . '</span>' . 
           '<span class="file-expires">' . $dayleft . ' days</span>' . 
-          '<span class="file-size">' . tripal_format_bytes($file->filesize) . '</span>' ,
+          '<span class="file-size">' . tripal_format_bytes($file->filesize) . '</span></span>' ,
         'class' => ['tree-node-file', ($i % 2 == 0) ? 'even' : 'odd'],
         'fid' => $file->fid,
         'uid' => $file->uid,

+ 11 - 2
tripal/theme/js/tripal.user_files.js

@@ -21,11 +21,20 @@
       // causing collapse.
       $('.tree-node-file').click(function(event) {
       	event.stopPropagation();
+      	
+      	// Reset the colors for all of the elements.
+        $('li.even').css("background-color", "#EEEEEE");
+        $('li.odd').css("background-color", "#FFFFFF");
+        
+        // Get the file details.
       	showFileDetails($(this));
+      	
+      	// Higlight the selected file.
+      	$(this).css("background-color", "#FFAAAA");
       });
     }
   }
-  
+
   /**
    * Prints the details of the selected file from the tree.
    */
@@ -37,7 +46,7 @@
       success: function(data) {
         $('#tripal-user-file-details').html(data);
       }
-    });
+    });  	
   }
   
   /**