3072: rendering "Empty Collection" in default_name
authorTim Pierce <twp@curoverse.com>
Mon, 21 Jul 2014 18:56:17 +0000 (14:56 -0400)
committerTim Pierce <twp@curoverse.com>
Mon, 21 Jul 2014 18:56:17 +0000 (14:56 -0400)
Collection.default_name now renders "Empty Collection" for collection
d41d8cd98f00b204e9800998ecf8427e.

Refs #3072.

apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/models/collection.rb

index 5b5034fbeca2e997cf93952ca262f0ccb22f1272..d1bac0c4cd2d1c8e24d60ef4c34327079643fd8b 100644 (file)
@@ -90,10 +90,6 @@ module ApplicationHelper
       if !link_name
         link_name = object.andand.default_name || resource_class.default_name
 
-        if resource_class == Collection && Collection.is_empty_blob_locator?(link_uuid)
-          link_name = "Empty Collection"
-        end
-
         if opts[:friendly_name]
           if attrvalue.respond_to? :friendly_link_name
             link_name = attrvalue.friendly_link_name
index 008d108fd43ed8a7e0a3abe45cc380492b03ba4b..764817509ac98ccb936a9d1d162758ef7da7cef4 100644 (file)
@@ -1,6 +1,14 @@
 class Collection < ArvadosBase
   MD5_EMPTY = 'd41d8cd98f00b204e9800998ecf8427e'
 
+  def default_name
+    if Collection.is_empty_blob_locator? self.uuid
+      "Empty Collection"
+    else
+      super
+    end
+  end
+
   # Return true if the given string is the locator of a zero-length blob
   def self.is_empty_blob_locator? locator
     !!locator.to_s.match("^#{MD5_EMPTY}(\\+.*)?\$")