Diff
Modified: branches/packs/app/helpers/application_helper.rb (3628 => 3629)
--- branches/packs/app/helpers/application_helper.rb 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/helpers/application_helper.rb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -741,6 +741,10 @@
return "famfamfam_silk/application_side_list.png"
when "contributions"
return "famfamfam_silk/page_white_stack.png"
+ when "annotations"
+ return "famfamfam_silk/note.png"
+ when "annotation"
+ return "famfamfam_silk/note.png"
else
return Conf.label_icons[method.to_s] if Conf.label_icons[method.to_s]
end
Modified: branches/packs/app/models/research_object.rb (3628 => 3629)
--- branches/packs/app/models/research_object.rb 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/models/research_object.rb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -609,6 +609,25 @@
graph
end
+ def annotations_with_templates
+
+ annotation_resources.map do |annotation_resource|
+
+ annotation = annotation_resource.annotation
+
+ graph = load_graph(annotation.ao_body.content_blob.data, annotation.ao_body.content_type)
+
+ template, parameters = find_template_from_graph(graph, Conf.ro_templates)
+
+ {
+ :annotation => annotation,
+ :graph => graph,
+ :template => template,
+ :parameters => parameters
+ }
+ end
+ end
+
private
def create_manifest #:nodoc:
Modified: branches/packs/app/models/resource.rb (3628 => 3629)
--- branches/packs/app/models/resource.rb 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/models/resource.rb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -234,6 +234,7 @@
graph = load_graph(annotation.ao_body.content_blob.data, annotation.ao_body.content_type)
template, parameters = research_object.find_template_from_graph(graph, Conf.ro_templates)
+
{
:annotation => annotation,
:graph => graph,
Added: branches/packs/app/views/annotations/_breadcrumbs.html.erb (0 => 3629)
--- branches/packs/app/views/annotations/_breadcrumbs.html.erb (rev 0)
+++ branches/packs/app/views/annotations/_breadcrumbs.html.erb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -0,0 +1,9 @@
+<li><%= link_to("Packs", packs_path) -%></li>
+<li><%= link_to(h(@pack.title), polymorphic_path(@pack)) -%></li>
+<li><%= link_to("Annotations", polymorphic_path(address@hidden, :annotations])) -%></li>
+
+<% case controller.action_name; when "new" %>
+ <li>New</li>
+<% when "show" %>
+ <li>Annotation</li>
+<% end %>
Added: branches/packs/app/views/annotations/_form.html.erb (0 => 3629)
--- branches/packs/app/views/annotations/_form.html.erb (rev 0)
+++ branches/packs/app/views/annotations/_form.html.erb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -0,0 +1,18 @@
+<%= hidden_field_tag(:annotation_type, template) %>
+
+<% if defined?(id) %>
+ <%= hidden_field_tag(:annotation_id, id) %>
+<% end %>
+
+<table class="annotation">
+ <% annotation_template["parameters"].each do |parameter| %>
+ <tr>
+ <td><%= parameter["label"] -%></td>
+ <% case parameter["type"] ; when "string" %>
+ <td><%= text_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
+ <% when "resource" %>
+ <td><%= text_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
+ <% end %>
+ </tr>
+ <% end %>
+</table>
Added: branches/packs/app/views/annotations/index.html.erb (0 => 3629)
--- branches/packs/app/views/annotations/index.html.erb (rev 0)
+++ branches/packs/app/views/annotations/index.html.erb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -0,0 +1,7 @@
+<h1>All annotations for <%=h @pack.title -%></h1>
+
+<% @annotations.each do |annotation| %>
+ <% next unless annotation[:template] %>
+ <%= render(:partial => 'packs/annotation', :locals => { :pack => @pack, :annotation => annotation } ) -%>
+<% end %>
+
Added: branches/packs/app/views/annotations/new.html.erb (0 => 3629)
--- branches/packs/app/views/annotations/new.html.erb (rev 0)
+++ branches/packs/app/views/annotations/new.html.erb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -0,0 +1,12 @@
+<h1>New <%=h @annotation_template["label"] -%> annotation</h1>
+
+<% form_tag(pack_annotations_path(@pack)) do |f| -%>
+ <%= render(:partial => "form", :locals => {
+ :template => params[:template],
+ :annotation_template => @annotation_template,
+ :values => params } ) -%>
+ <%= submit_tag("Add") -%>
+<% end %>
+
+<h2>Debug</h2>
+<pre><%=h @annotation_template.to_yaml -%></pre>
Added: branches/packs/app/views/annotations/show.html.erb (0 => 3629)
--- branches/packs/app/views/annotations/show.html.erb (rev 0)
+++ branches/packs/app/views/annotations/show.html.erb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -0,0 +1,6 @@
+<h1>Annotation</h1>
+
+<h2>Debug</h2>
+
+<pre><%=h @annotation_template.to_yaml -%></pre>
+<pre><%=h @parameters.to_yaml -%></pre>
Modified: branches/packs/app/views/packs/_add_item.rhtml (3628 => 3629)
--- branches/packs/app/views/packs/_add_item.rhtml 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/views/packs/_add_item.rhtml 2013-08-27 13:32:28 UTC (rev 3629)
@@ -129,7 +129,7 @@
<% if @ore_resources.count > 1 %>
<% form_tag(pack_annotations_path(@pack)) do -%>
<%= select_tag(:subject, options_for_select(@ore_resources.map { |r| [r[:name], r[:ore_path]] }) ) -%>
- <%= select_tag(:annotation_type, options_for_select(@ro_relationships.map { |r| [r["label"], r["label"]] }) ) -%>
+ <%= select_tag(:annotation_type, options_for_select(@ro_relationships.map { |r| [r["label"], r["template"]] }) ) -%>
<%= select_tag(:object, options_for_select(@ore_resources.map { |r| [r[:name], r[:ore_path]] }) ) -%>
<%= submit_tag("Add") -%>
<% end %>
Modified: branches/packs/app/views/packs/_annotation.html.erb (3628 => 3629)
--- branches/packs/app/views/packs/_annotation.html.erb 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/views/packs/_annotation.html.erb 2013-08-27 13:32:28 UTC (rev 3629)
@@ -1,9 +1,21 @@
<div class="annotation">
- <p>Annotation type: <%=h annotation[:template]["label"] -%></p>
- <% case annotation[:template]["label"]; when "Title" %>
+ <div class="header">
<p>
- <span class="label">Title</span>
- <span class="value"><%=h annotation[:parameters][:title].to_s -%></span>
+ <span class="type"><%= link_to(h(annotation[:template]["label"]), pack_annotation_path(pack, annotation[:annotation].uuid)) -%></span>
+ <%= link_to_remote("<img src='' />",
+ :update => "annotation-#{annotation[:annotation].uuid}",
+ :url ="" pack_annotation_path(pack, annotation[:annotation].uuid),
+ :method => :delete,
+ :confirm => "Are you sure you want to delete this annotation?" ) %>
</p>
+ </div>
+ <% if annotation[:template] %>
+ <% annotation[:template]["parameters"].each do |parameter| %>
+ <p>
+ <span class="label"><%=h parameter["label"] -%></span>
+ <span class="value"><%=h annotation[:parameters][parameter["symbol"]].to_s -%></span>
+ </p>
+ <% end %>
<% end %>
</div>
+
Modified: branches/packs/app/views/packs/_breadcrumbs.rhtml (3628 => 3629)
--- branches/packs/app/views/packs/_breadcrumbs.rhtml 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/views/packs/_breadcrumbs.rhtml 2013-08-27 13:32:28 UTC (rev 3629)
@@ -9,7 +9,7 @@
<li><%= link_to 'Packs', packs_path %></li>
<% end %>
-<% if ["show", "new", "edit", "all", "new_item", "edit_item", "search"].include? controller.action_name.to_s %>
+<% if ["show", "new", "edit", "all", "new_item", "edit_item", "search", "item_show"].include? controller.action_name.to_s %>
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@pack.title) %></li>
<% when "new" %>
@@ -27,6 +27,9 @@
<li>All Packs</li>
<% when "search" %>
<li>Search Results</li>
+ <% when "item_show" %>
+ <li><%= link_to "#{h(@pack.title)}", pack_path(@pack) %></li>
+ <li><%=h @item.folder_entry.entry_name -%></li>
<% else %>
<!-- no breadcrumb -->
<% end %>
Modified: branches/packs/app/views/packs/show.rhtml (3628 => 3629)
--- branches/packs/app/views/packs/show.rhtml 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/app/views/packs/show.rhtml 2013-08-27 13:32:28 UTC (rev 3629)
@@ -9,6 +9,7 @@
<% if mine?(@pack) -%>
<li><%= icon('manage', edit_pack_path(@pack), nil, nil, 'Manage Pack') -%></li>
<% end -%>
+ <li><%= icon('annotations', pack_annotations_path(@pack), nil, nil, 'Annotations') -%></li>
<% if @authorised_to_edit -%>
<li><%= icon('new', snapshot_pack_path(@pack), nil, { :confirm => 'Are you sure that you would like to create a new snapshot of this Pack?', :method => :post }, 'Create snapshot') %></li>
<% end -%>
@@ -167,6 +168,7 @@
<% @pack.research_object.resources.each do |resource| %>
<% ore_path = resource.ore_path %>
<% next unless ore_path %>
+ <% next if resource.is_folder %>
<tr>
<td><%= link_to(h(resource.path), pack_items_path(@pack) + "/" + ore_path) -%></td>
<td><%=h resource.size -%></td>
Modified: branches/packs/config/default_settings.yml (3628 => 3629)
--- branches/packs/config/default_settings.yml 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/config/default_settings.yml 2013-08-27 13:32:28 UTC (rev 3629)
@@ -1457,6 +1457,7 @@
- label: "Input selected"
uri: "http://purl.org/wf4ever/roterms#inputSelected"
+ template: input_selection_relationship
- label: "Output selected"
uri: "http://purl.org/wf4ever/roterms#outputSelected"
@@ -1484,23 +1485,44 @@
input_selection_relationship:
- label: Input selected
+ label: input selection
- types:
+ parameters:
- :subject: workflow
- :object: contributable
+ - label: Workflow
+ type: resource
+ symbol: :subject
+ - label: Input file
+ type: resource
+ symbol: :object
+
required_statements:
- [:subject, "<http://purl.org/wf4ever/roterms#inputSelected>", :object]
+ targets:
+ - :subject
+ - :object
+
title:
- label: Title
+ label: title
+ parameters:
+
+ - label: Resource
+ type: resource
+ symbol: :resource
+
+ - label: Title
+ type: string
+ symbol: :title
+
required_statements:
- [:resource, "<http://purl.org/dc/terms/title>", :title]
+ targets:
+ - :resource
wf_ro_service_uri: "http://www.example.com/wf-ro/jobs"
wf_ro_service_bearer_token: "bearer-token"
Modified: branches/packs/public/stylesheets/styles.css (3628 => 3629)
--- branches/packs/public/stylesheets/styles.css 2013-08-27 13:31:14 UTC (rev 3628)
+++ branches/packs/public/stylesheets/styles.css 2013-08-27 13:32:28 UTC (rev 3629)
@@ -2655,3 +2655,25 @@
font-family: monospace;
}
+.annotation {
+ border: 1px solid #aaa;
+ box-shadow: 4px 4px 8px #ddd;
+ margin: 8px;
+ padding: 4px;
+}
+
+.annotation TD {
+ text-align: left;
+}
+
+.annotation .type {
+ font-size: 180%;
+}
+
+.annotation .label:after {
+ content: ":";
+}
+
+.annotation INPUT {
+ width: 500px;
+}