myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3016] branches/showcase48/app: added basic annot


From: noreply
Subject: [myexperiment-hackers] [3016] branches/showcase48/app: added basic annotation display to workflow show page
Date: Wed, 6 Jun 2012 08:48:56 +0000 (UTC)

Revision
3016
Author
dgc
Date
2012-06-06 08:48:55 +0000 (Wed, 06 Jun 2012)

Log Message

added basic annotation display to workflow show page

Modified Paths

Diff

Modified: branches/showcase48/app/helpers/research_objects_helper.rb (3015 => 3016)


--- branches/showcase48/app/helpers/research_objects_helper.rb	2012-06-06 08:37:51 UTC (rev 3015)
+++ branches/showcase48/app/helpers/research_objects_helper.rb	2012-06-06 08:48:55 UTC (rev 3016)
@@ -38,4 +38,17 @@
     uris
   end
 
+  def research_object_annotations(contributable)
+
+    return [] unless contributable.respond_to?(:content_blob)
+
+    hash = contributable.content_blob.md5
+    
+    annotations = Annotation.find(:all,
+        :joins      => "JOIN annotations AS a1 ON annotations.subject_text = a1.subject_text",
+        :conditions => ["a1.predicate_text = ? AND a1.objekt_text = ?",
+                        "http://purl.org/wf4ever/ro#checksum",
+                        "urn:MD5:#{hash.upcase}"])
+  end
+
 end

Modified: branches/showcase48/app/views/workflows/show.rhtml (3015 => 3016)


--- branches/showcase48/app/views/workflows/show.rhtml	2012-06-06 08:37:51 UTC (rev 3015)
+++ branches/showcase48/app/views/workflows/show.rhtml	2012-06-06 08:48:55 UTC (rev 3016)
@@ -270,6 +270,34 @@
 		
 			<br/>
 			
+      <% annotations = research_object_annotations(@workflow) %>
+
+      <% if annotations.length > 0 %>
+
+      <h3>Annotations</h3>
+
+      <div class="fold">
+
+        <div class="foldTitle">Annotations (<%= annotations.length -%>)</div>
+        <div class="foldContent" style="display: none;">
+
+          <div id="annotation_list">
+            <% annotations.each do |annotation| %>
+              <div>
+                <table>
+                  <tr><td><%=h annotation.research_object.title -%></td></tr>
+                  <tr><td><%=h annotation.subject_text          -%></td></tr>
+                  <tr><td><%=h annotation.predicate_text        -%></td></tr>
+                  <tr><td><%=h annotation.objekt_text           -%></td></tr>
+                </table>
+              </div>
+            <% end %>
+          </div>
+        </div>
+      </div>
+
+      <% end %>
+
 			<h3>
 				<%= info_icon_with_tooltip("This section shows the internal components of this workflow version") %>
 				Workflow Components

reply via email to

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