myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3514] branches/wf4ever/app: added function to de


From: noreply
Subject: [myexperiment-hackers] [3514] branches/wf4ever/app: added function to determine resource labels
Date: Tue, 16 Apr 2013 14:38:01 +0000 (UTC)

Revision
3514
Author
dgc
Date
2013-04-16 14:38:01 +0000 (Tue, 16 Apr 2013)

Log Message

added function to determine resource labels

Modified Paths

Diff

Modified: branches/wf4ever/app/models/pack.rb (3513 => 3514)


--- branches/wf4ever/app/models/pack.rb	2013-04-16 14:08:54 UTC (rev 3513)
+++ branches/wf4ever/app/models/pack.rb	2013-04-16 14:38:01 UTC (rev 3514)
@@ -115,6 +115,13 @@
     nil 
   end
 
+  def resource_label(uri)
+    label = @manifest.query([RDF::URI.parse(uri), RDF::URI.parse("http://purl.org/wf4ever/ro#name"), nil]).first_value
+
+    return label if label
+
+    uri.split("/").last
+  end
 end
 
 class Pack < ActiveRecord::Base

Modified: branches/wf4ever/app/views/packs/show.rhtml (3513 => 3514)


--- branches/wf4ever/app/views/packs/show.rhtml	2013-04-16 14:08:54 UTC (rev 3513)
+++ branches/wf4ever/app/views/packs/show.rhtml	2013-04-16 14:38:01 UTC (rev 3514)
@@ -105,7 +105,7 @@
   <h3>Hypothesis</h3>
   <ul>
     <% @hypothesis.each do |resource| %>
-      <li><%= link_to(h(resource), resource) -%></li>
+      <li><%= link_to(h(@pack.contributable_entries.resource_label(resource)), resource) -%></li>
     <% end %>
   </ul>
 <% end %>
@@ -114,7 +114,7 @@
   <h3>Conclusions</h3>
   <ul>
     <% @conclusions.each do |resource| %>
-      <li><%= link_to(h(resource), resource) -%></li>
+      <li><%= link_to(h(@pack.contributable_entries.resource_label(resource)), resource) -%></li>
     <% end %>
   </ul>
 <% end %>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]