add links to generic specimen and project #show
authorTom Clegg <tom@clinicalfuture.com>
Thu, 7 Feb 2013 19:45:47 +0000 (14:45 -0500)
committerTom Clegg <tom@clinicalfuture.com>
Thu, 7 Feb 2013 19:45:59 +0000 (14:45 -0500)
app/helpers/application_helper.rb
app/models/orvos_base.rb
app/views/pipeline_invocations/show.html.erb [new file with mode: 0644]
app/views/projects/show.html.erb [new file with mode: 0644]
app/views/specimens/show.html.erb [new file with mode: 0644]

index 8a14e27b6699ce845fd90abd9f36eb10cb52ccf8..3d06144abf1662bfc5082f5db8414cd1a9277e99 100644 (file)
@@ -16,12 +16,15 @@ module ApplicationHelper
   def link_to_if_orvos_object(attrvalue, opts={})
     if (resource_class = OrvosBase::resource_class_for_uuid(attrvalue, opts[:referring_attr], opts[:referring_object]))
       link_uuid = attrvalue.is_a?(OrvosBase) ? attrvalue.uuid : attrvalue
-      link_name = link_uuid
-      if !opts[:with_prefixes]
-        link_name = link_name.sub /^.{5}-.{5}-/, ''
-      end
-      if opts[:with_class_name]
-        link_name = "#{resource_class.to_s} #{link_name}"
+      link_name = opts[:link_text]
+      if !link_name
+        link_name = link_uuid
+        if !opts[:with_prefixes]
+          link_name = link_name.sub /^.{5}-.{5}-/, ''
+        end
+        if opts[:with_class_name]
+          link_name = "#{resource_class.to_s} #{link_name}"
+        end
       end
       link_to link_name, { controller: resource_class.to_s.underscore.pluralize, action: 'show', id: link_uuid }
     else
index 43da26a30da5512c656d67cd88bf3891177248e4..824c46665758ef2274809ae0ce8cc00262728cc3 100644 (file)
@@ -7,7 +7,9 @@ class OrvosBase < ActiveRecord::Base
       '4zz18' => 'orvos#collection',
       'tpzed' => 'orvos#user',
       'ozdt8' => 'orvos#api_client',
-      '57u5n' => 'orvos#log'
+      '57u5n' => 'orvos#log',
+      'j58dm' => 'orvos#specimen',
+      'ldvyl' => 'orvos#project'
     }
   end
 
@@ -185,7 +187,7 @@ class OrvosBase < ActiveRecord::Base
       return nil
     end
     if uuid.match /^[0-9a-f]{32}(\+[^,]+)*(,[0-9a-f]{32}(\+[^,]+)*)*$/
-      return 'orvos#collection'
+      return Collection
     end
     resource_class = nil
     uuid.match /^[0-9a-z]{5}-([0-9a-z]{5})-[0-9a-z]{15}$/ do |re|
diff --git a/app/views/pipeline_invocations/show.html.erb b/app/views/pipeline_invocations/show.html.erb
new file mode 100644 (file)
index 0000000..68f5fa9
--- /dev/null
@@ -0,0 +1 @@
+<%= render :partial => 'application/orvos_object' %>
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
new file mode 100644 (file)
index 0000000..68f5fa9
--- /dev/null
@@ -0,0 +1 @@
+<%= render :partial => 'application/orvos_object' %>
diff --git a/app/views/specimens/show.html.erb b/app/views/specimens/show.html.erb
new file mode 100644 (file)
index 0000000..68f5fa9
--- /dev/null
@@ -0,0 +1 @@
+<%= render :partial => 'application/orvos_object' %>