Diff
Modified: branches/packs/app/controllers/annotations_controller.rb (3634 => 3635)
--- branches/packs/app/controllers/annotations_controller.rb 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/app/controllers/annotations_controller.rb 2013-08-28 09:46:45 UTC (rev 3635)
@@ -83,7 +83,7 @@
pack.research_object.update_manifest!
- redirect_to pack_path(pack)
+ redirect_to pack_annotations_path(pack)
end
def new
Modified: branches/packs/app/controllers/packs_controller.rb (3634 => 3635)
--- branches/packs/app/controllers/packs_controller.rb 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/app/controllers/packs_controller.rb 2013-08-28 09:46:45 UTC (rev 3635)
@@ -14,7 +14,7 @@
RO_RESOURCE = "http://purl.org/wf4ever/ro#Resource"
WORKFLOW_RUN = "http://purl.org/wf4ever/roterms#WorkflowRunBundle"
- before_filter :login_required, :except => [:index, :show, :search, :items, :download, :statistics, :item_show]
+ before_filter :login_required, :except => [:index, :show, :search, :items, :download, :statistics, :item_show, :item_destroy]
before_filter :find_pack_auth, :except => [:index, :new, :create, :search]
@@ -489,6 +489,23 @@
end
end
+ def item_destroy
+ @item = @pack.research_object.find_using_path(params[:item_path])
+
+ if @item.nil?
+ render_404("Pack item not found.")
+ return
+ end
+
+ # Delete the pack contributable entry if it exists.
+ pce = @item.pack_contributable_entry.destroy if @item.pack_contributable_entry
+
+ # Delete the resource
+ @item.destroy
+
+ render pack_path(@pack)
+ end
+
protected
# Check that a protocol is specified in the URI; prepend HTTP:// otherwise
@@ -515,6 +532,7 @@
"favourite_delete" => "view",
"index" => "view",
"items" => "view",
+ "item_destroy" => "edit",
"item_show" => "view",
"new" => "create",
"new_item" => "edit",
Modified: branches/packs/app/models/research_object.rb (3634 => 3635)
--- branches/packs/app/models/research_object.rb 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/app/models/research_object.rb 2013-08-28 09:46:45 UTC (rev 3635)
@@ -611,9 +611,9 @@
def annotations_with_templates
- annotation_resources.map do |annotation_resource|
+ annotations = annotation_resources.map { |annotation_resource| annotation_resource.annotation }
- annotation = annotation_resource.annotation
+ annotations.uniq.map do |annotation|
graph = load_graph(annotation.ao_body.content_blob.data, annotation.ao_body.content_type)
Modified: branches/packs/app/views/packs/_annotation.html.erb (3634 => 3635)
--- branches/packs/app/views/packs/_annotation.html.erb 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/app/views/packs/_annotation.html.erb 2013-08-28 09:46:45 UTC (rev 3635)
@@ -1,21 +1,24 @@
<div class="annotation">
<div class="header">
<p>
- <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),
+ <div style="float: right">
+ <%= link_to("<img src='' />",
+ pack_annotation_path(pack, annotation[:annotation].uuid),
:method => :delete,
- :confirm => "Are you sure you want to delete this annotation?" ) %>
+ :confirm => "Are you sure you want to delete this annotation?") %>
+ </div>
+ <span class="type"><%= link_to(h(annotation[:template]["label"].capitalize), pack_annotation_path(pack, annotation[:annotation].uuid)) -%></span>
</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 %>
+ <table>
+ <% annotation[:template]["parameters"].each do |parameter| %>
+ <tr>
+ <td class="label"><%=h parameter["label"] -%></td>
+ <td class="value"><%=h annotation[:parameters][parameter["symbol"]].to_s -%></td>
+ </tr>
+ <% end %>
+ </table>
<% end %>
</div>
Modified: branches/packs/app/views/packs/show.rhtml (3634 => 3635)
--- branches/packs/app/views/packs/show.rhtml 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/app/views/packs/show.rhtml 2013-08-28 09:46:45 UTC (rev 3635)
@@ -149,13 +149,6 @@
<div id="tabsContainer" class="tabsContainer"></div>
<div class="tabContainer">
- <div class="tabTitle">Structure</div>
- <div class="tabContent">
- <pre><%=h @pack.research_object.ore_structure.to_yaml -%></pre>
- </div>
- </div>
-
- <div class="tabContainer">
<div class="tabTitle">ORE entries</div>
<div class="tabContent">
<table class="simple">
@@ -164,6 +157,9 @@
<th>Size</th>
<th>Content type</th>
<th>Annotations</th>
+ <% if false %>
+ <th></th>
+ <% end %>
</tr>
<% @pack.research_object.resources.each do |resource| %>
<% ore_path = resource.ore_path %>
@@ -174,6 +170,14 @@
<td><%=h resource.size -%></td>
<td><%=h resource.content_type -%></td>
<td><%=h resource.annotations.count -%></td>
+ <% if false %>
+ <td>
+ <%= link_to_remote("<img src='' />",
+ :url ="" pack_item_path(@pack, resource.ore_path),
+ :method => :delete,
+ :confirm => "Are you sure you want to delete this item?" ) %>
+ </td>
+ <% end %>
</tr>
<% end %>
</table>
@@ -181,6 +185,13 @@
</div>
<div class="tabContainer">
+ <div class="tabTitle">Structure</div>
+ <div class="tabContent">
+ <pre><%=h @pack.research_object.ore_structure.to_yaml -%></pre>
+ </div>
+ </div>
+
+ <div class="tabContainer">
<div class="tabTitle">Resources</div>
<div class="tabContent">
<table class="simple">
Modified: branches/packs/config/routes.rb (3634 => 3635)
--- branches/packs/config/routes.rb 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/config/routes.rb 2013-08-28 09:46:45 UTC (rev 3635)
@@ -75,6 +75,7 @@
map.pack_items '/packs/:id/items', :controller => 'packs', :action ="" 'item_index', :conditions => { :method => :get }
map.pack_item '/packs/:id/items/:item_path', :controller => 'packs', :action ="" 'item_show', :conditions => { :method => :get }, :requirements => { :item_path => /[^;]+/ }
+ map.pack_item '/packs/:id/items/:item_path', :controller => 'packs', :action ="" 'item_destroy', :conditions => { :method => :delete }, :requirements => { :item_path => /[^;]+/ }
# workflows (downloadable)
map.resources :workflows,
Added: branches/packs/public/images/grey_cross.png
(Binary files differ)
Property changes on: branches/packs/public/images/grey_cross.png
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
Modified: branches/packs/public/stylesheets/styles.css (3634 => 3635)
--- branches/packs/public/stylesheets/styles.css 2013-08-28 09:46:36 UTC (rev 3634)
+++ branches/packs/public/stylesheets/styles.css 2013-08-28 09:46:45 UTC (rev 3635)
@@ -2662,6 +2662,14 @@
padding: 4px;
}
+.annotation .header {
+ padding-left: 5px;
+}
+
+.annotation .header IMG {
+ padding-right: 8px;
+}
+
.annotation TD {
text-align: left;
vertical-align: top;