Diff
Modified: branches/packs/app/helpers/research_objects_helper.rb (3673 => 3674)
--- branches/packs/app/helpers/research_objects_helper.rb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/helpers/research_objects_helper.rb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -233,14 +233,16 @@
pretty_rdf_xml(render_rdf(graph))
end
- def pack_resource_path_fixed(pack, resource)
+ def resource_path_fixed(context, resource)
+ resources_path = polymorphic_path([context, :items])
+
ore_path = resource.ore_path
if resource.is_root_folder?
- "/packs/#{pack.id}/resources"
+ resources_path
elsif ore_path
- "/packs/#{pack.id}/resources/#{ore_path}"
+ "#{resources_path}/#{ore_path}"
else
throw "No ORE path to this resource"
end
Modified: branches/packs/app/models/research_object.rb (3673 => 3674)
--- branches/packs/app/models/research_object.rb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/models/research_object.rb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -514,7 +514,7 @@
{
:name => entry.entry_name,
:type => :file,
- :path => entry.proxy_for.path
+ :path => entry.proxy_for_path
}
end
end
Copied: branches/packs/app/views/annotations/_annotation.html.erb (from rev 3670, branches/packs/app/views/packs/_annotation.html.erb) (0 => 3674)
--- branches/packs/app/views/annotations/_annotation.html.erb (rev 0)
+++ branches/packs/app/views/annotations/_annotation.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -0,0 +1,48 @@
+<div class="annotation">
+ <div class="header">
+ <p>
+ <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?") %>
+ </div>
+ <span class="type"><%= link_to(h(annotation[:template]["label"].capitalize), pack_annotation_path(pack, annotation[:annotation].uuid)) -%></span>
+ </p>
+ </div>
+ <% if annotation[:template] %>
+ <table>
+ <% annotation[:template]["parameters"].each do |parameter| %>
+
+ <% label = parameter["label"] %>
+ <% value = annotation[:parameters][parameter["symbol"]].to_s %>
+
+ <% if parameter["type"] == "select" %>
+ <% value_match = parameter["options"].find { |option| value == option[1] } %>
+ <% value = value_match[0] if value_match %>
+ <% end %>
+
+ <% unless value.empty? %>
+ <tr>
+ <td class="label"><%=h label -%></td>
+ <td class="value">
+ <% if parameter["type"] == "resource" %>
+ <%= resource_link(pack.find_resource_by_path(value)) -%>
+ <% else %>
+ <%=h value -%>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% end %>
+ </table>
+ <% end %>
+
+ <div class="provenance">
+ Created by
+ <span class="contributor"><%= user_link(annotation[:annotation].creator_uri) -%></span>
+ on
+ <span class="date"><%= datetime(annotation[:annotation].created_at, false) -%></span>
+ </div>
+</div>
+
Modified: branches/packs/app/views/annotations/_form.html.erb (3673 => 3674)
--- branches/packs/app/views/annotations/_form.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/annotations/_form.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -33,7 +33,7 @@
<% when "textarea" %>
<%= text_area_tag(parameter["symbol"], values[parameter["symbol"]]) -%>
<% when "resource" %>
- <%= select_tag(parameter["symbol"], options_for_select(research_object.ore_resources.map { |r| [r[:name], r[:ore_path]] })) -%>
+ <%= select_tag(parameter["symbol"], options_for_select(research_object.ore_resources.map { |r| [r[:proxy_target] ? r[:proxy_target] : r[:name], r[:ore_path]] })) -%>
<% end %>
</td>
<% unless parameter["optional"] == true %>
Modified: branches/packs/app/views/annotations/index.html.erb (3673 => 3674)
--- branches/packs/app/views/annotations/index.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/annotations/index.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -2,6 +2,6 @@
<% @annotations.each do |annotation| %>
<% next unless annotation[:template] %>
- <%= render(:partial => 'packs/annotation', :locals => { :pack => @pack, :annotation => annotation } ) -%>
+ <%= render(:partial => 'annotation', :locals => { :pack => @pack, :annotation => annotation } ) -%>
<% end %>
Deleted: branches/packs/app/views/packs/_annotation.html.erb (3673 => 3674)
--- branches/packs/app/views/packs/_annotation.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/_annotation.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -1,48 +0,0 @@
-<div class="annotation">
- <div class="header">
- <p>
- <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?") %>
- </div>
- <span class="type"><%= link_to(h(annotation[:template]["label"].capitalize), pack_annotation_path(pack, annotation[:annotation].uuid)) -%></span>
- </p>
- </div>
- <% if annotation[:template] %>
- <table>
- <% annotation[:template]["parameters"].each do |parameter| %>
-
- <% label = parameter["label"] %>
- <% value = annotation[:parameters][parameter["symbol"]].to_s %>
-
- <% if parameter["type"] == "select" %>
- <% value_match = parameter["options"].find { |option| value == option[1] } %>
- <% value = value_match[0] if value_match %>
- <% end %>
-
- <% unless value.empty? %>
- <tr>
- <td class="label"><%=h label -%></td>
- <td class="value">
- <% if parameter["type"] == "resource" %>
- <%= resource_link(pack.find_resource_by_path(value)) -%>
- <% else %>
- <%=h value -%>
- <% end %>
- </td>
- </tr>
- <% end %>
- <% end %>
- </table>
- <% end %>
-
- <div class="provenance">
- Created by
- <span class="contributor"><%= user_link(annotation[:annotation].creator_uri) -%></span>
- on
- <span class="date"><%= datetime(annotation[:annotation].created_at, false) -%></span>
- </div>
-</div>
-
Modified: branches/packs/app/views/packs/_breadcrumbs.rhtml (3673 => 3674)
--- branches/packs/app/views/packs/_breadcrumbs.rhtml 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/_breadcrumbs.rhtml 2013-09-05 12:27:44 UTC (rev 3674)
@@ -32,7 +32,7 @@
<li><%= link_to("Resources", pack_items_path(@pack)) -%></li>
<% unless @item.is_root_folder %>
<% parent_folders(@item).each do |folder| %>
- <li><%= link_to(h(folder.folder_entry.entry_name), pack_resource_path_fixed(@pack, folder)) -%></li>
+ <li><%= link_to(h(folder.folder_entry.entry_name), resource_path_fixed(@pack, folder)) -%></li>
<% end %>
<li><%=h @item.folder_entry.entry_name -%></li>
<% end %>
Deleted: branches/packs/app/views/packs/_resource_tile.html.erb (3673 => 3674)
--- branches/packs/app/views/packs/_resource_tile.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/_resource_tile.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -1,20 +0,0 @@
-<% ore_path = resource.ore_path %>
-<% association = find_association(resource) %>
-<tr>
- <td><%= resource_link(resource) -%></td>
- <% if resource.is_folder || resource.is_proxy %>
- <td></td>
- <% else %>
- <td><%=h resource.size -%></td>
- <% end %>
- <td><%=h association["label"] -%></td>
- <td><%=h resource.annotations.count -%></td>
- <td>
- <% if !resource.is_folder && Authorization.check('destroy', resource, current_user) %>
- <%= link_to("<img src='' />",
- pack_item_path(pack, ore_path),
- :method => :delete,
- :confirm => "Are you sure you want to delete this item?") %>
- <% end %>
- </td>
-</tr>
Deleted: branches/packs/app/views/packs/_resource_tiles.html.erb (3673 => 3674)
--- branches/packs/app/views/packs/_resource_tiles.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/_resource_tiles.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -1,16 +0,0 @@
-<table class="simple">
- <tr>
- <th>Path</th>
- <th>Size</th>
- <th>Type</th>
- <th>Annotations</th>
- <th></th>
- </tr>
- <% resources.each do |resource| %>
- <% ore_path = resource.ore_path %>
- <% next unless ore_path %>
- <% if Authorization.check('view', resource, current_user) %>
- <%= render :partial => "resource_tile", :locals => { :pack => pack, :resource => resource } -%>
- <% end %>
- <% end %>
-</table>
Deleted: branches/packs/app/views/packs/folder_show.html.erb (3673 => 3674)
--- branches/packs/app/views/packs/folder_show.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/folder_show.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -1,13 +0,0 @@
-<% if @item.is_root_folder %>
- <h1>Pack resources</h1>
-<% else %>
- <% parent = @item.folder_entry.proxy_in %>
- <h1>Pack folder: <%=h @item.folder_entry.entry_name -%></h1>
- <p>Parent folder is:
- <% label = parent.is_root_folder ? "Top level" : @item.folder_entry.proxy_in.folder_entry.entry_name %>
- <%= link_to(h(label), pack_resource_path_fixed(@pack, @item.folder_entry.proxy_in)) -%>
- </p>
-<% end %>
-
-<%= render :partial => 'resource_tiles', :locals => { :pack => @pack,
- :resources => @item.proxies.map { |p| p.proxy_for } } -%>
Modified: branches/packs/app/views/packs/item_show.html.erb (3673 => 3674)
--- branches/packs/app/views/packs/item_show.html.erb 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/item_show.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -122,7 +122,7 @@
<div class="tabTitle">User level annotations</div>
<div class="tabContent">
<% @visible_annotations.each do |annotation| %>
- <%= render(:partial => "annotation", :locals => { :pack => @pack, :annotation => annotation } ) -%>
+ <%= render(:partial => "annotations/annotation", :locals => { :pack => @pack, :annotation => annotation } ) -%>
<% end %>
</div>
</div>
Modified: branches/packs/app/views/packs/show.rhtml (3673 => 3674)
--- branches/packs/app/views/packs/show.rhtml 2013-09-05 08:17:20 UTC (rev 3673)
+++ branches/packs/app/views/packs/show.rhtml 2013-09-05 12:27:44 UTC (rev 3674)
@@ -124,7 +124,7 @@
<div class="tabContainer">
<div class="tabTitle">ORE Entries</div>
<div class="tabContent">
- <%= render :partial => 'resource_tiles', :locals => { :pack => @pack,
+ <%= render :partial => 'resources/resource_tiles', :locals => { :context => @pack,
:resources => @pack.research_object.resources.select { |r| !r.is_folder } } -%>
</div>
</div>
Copied: branches/packs/app/views/resources/_folder_list.html.erb (from rev 3667, branches/packs/app/views/packs/folder_show.html.erb) (0 => 3674)
--- branches/packs/app/views/resources/_folder_list.html.erb (rev 0)
+++ branches/packs/app/views/resources/_folder_list.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -0,0 +1,10 @@
+<% unless item.is_root_folder %>
+ <p>Parent folder is:
+ <% parent = @item.folder_entry.proxy_in %>
+ <% label = parent.is_root_folder ? "Top level" : item.folder_entry.proxy_in.folder_entry.entry_name %>
+ <%= link_to(h(label), resource_path_fixed(context, item.folder_entry.proxy_in)) -%>
+ </p>
+<% end %>
+
+<%= render :partial => 'resources/resource_tiles', :locals => { :context => context,
+ :resources => item.proxies.map { |p| p.proxy_for } } -%>
Copied: branches/packs/app/views/resources/_resource_tile.html.erb (from rev 3667, branches/packs/app/views/packs/_resource_tile.html.erb) (0 => 3674)
--- branches/packs/app/views/resources/_resource_tile.html.erb (rev 0)
+++ branches/packs/app/views/resources/_resource_tile.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -0,0 +1,20 @@
+<% ore_path = resource.ore_path %>
+<% association = find_association(resource) %>
+<tr>
+ <td><%= resource_link(resource) -%></td>
+ <% if resource.is_folder || resource.is_proxy %>
+ <td></td>
+ <% else %>
+ <td><%=h resource.size -%></td>
+ <% end %>
+ <td><%=h association["label"] -%></td>
+ <td><%=h resource.annotations.count -%></td>
+ <td>
+ <% if !resource.is_folder && Authorization.check('destroy', resource, current_user) %>
+ <%= link_to("<img src='' />",
+ "#{polymorphic_path([context, :items])}/#{ore_path}",
+ :method => :delete,
+ :confirm => "Are you sure you want to delete this item?") %>
+ <% end %>
+ </td>
+</tr>
Copied: branches/packs/app/views/resources/_resource_tiles.html.erb (from rev 3667, branches/packs/app/views/packs/_resource_tiles.html.erb) (0 => 3674)
--- branches/packs/app/views/resources/_resource_tiles.html.erb (rev 0)
+++ branches/packs/app/views/resources/_resource_tiles.html.erb 2013-09-05 12:27:44 UTC (rev 3674)
@@ -0,0 +1,16 @@
+<table class="simple">
+ <tr>
+ <th>Path</th>
+ <th>Size</th>
+ <th>Type</th>
+ <th>Annotations</th>
+ <th></th>
+ </tr>
+ <% resources.each do |resource| %>
+ <% ore_path = resource.ore_path %>
+ <% next unless ore_path %>
+ <% if Authorization.check('view', resource, current_user) %>
+ <%= render :partial => "resources/resource_tile", :locals => { :context => context, :resource => resource } -%>
+ <% end %>
+ <% end %>
+</table>