Display first file in collection if name field is nil or empty. refs #3504
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 22 Aug 2014 17:56:59 +0000 (13:56 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 22 Aug 2014 17:56:59 +0000 (13:56 -0400)
apps/workbench/app/views/collections/_choose_rows.html.erb

index 27b66e4482314f3121a0f46e8ae9dd21cfe20766..da0f9759c1beae0c6f3c71786bdc438a17315fdb 100644 (file)
@@ -4,7 +4,14 @@
          style="margin-left: 1em; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #DDDDDD">
       <i class="fa fa-fw fa-archive"></i>
       <% if object.respond_to? :name %>
-        <%= object.name %>
+        <% if not (object.name.nil? or object.name.empty?) %>
+          <%= object.name %>
+        <% elsif object.is_a? Collection and object.files.length > 0 %>
+          <%= object.files[0][1] %>
+          <%= "+ #{object.files.length-1} more" if object.files.length > 1 %>
+        <% else %>
+          <%= object.uuid %>
+        <% end %>
       <% else %>
         <%= object.uuid %>
       <% end %>