Modified: branches/wf4ever/app/controllers/packs_controller.rb (3373 => 3374)
--- branches/wf4ever/app/controllers/packs_controller.rb 2013-01-29 18:41:07 UTC (rev 3373)
+++ branches/wf4ever/app/controllers/packs_controller.rb 2013-01-29 18:41:16 UTC (rev 3374)
@@ -113,25 +113,36 @@
end
+ def resource_types(resuri)
+ @annotations.query([resuri, RDF::type, nil]).map do |s,p,type|
+ type.to_s
+ end
+ end
+
+ def textual_type(typeuri)
+ type = Conf.ro_resource_types.rassoc(typeuri)
+ type.first if type
+ end
+
# GET /packs/:id/resources/:resource_path
def resource_show
-
# Get annotations as merged graph. This will be pulled from cache
# eventually.
session = ROSRS::Session.new(@pack.ro_uri, Conf.rodl_bearer_token)
-
@annotations = session.get_annotation_graph(@pack.ro_uri, @resuri)
-
@annotations.query(address@hidden, nil, nil]).each do |statement|
-
+ puts statement
case statement.predicate.to_s
when "http://purl.org/dc/terms/title": @title = statement.object.to_s
when "http://purl.org/dc/terms/description": @description = statement.object.to_s
when "http://purl.org/dc/terms/creator": @creator = statement.object.to_s
when "http://purl.org/dc/terms/created": @created = Date.parse(statement.object.to_s)
end
+ end
+ @types = resource_types(@resuri).map do |typeuri|
+ textual_type(typeuri) or typeuri
end
render :resource_show
Modified: branches/wf4ever/app/views/packs/resource_show.rhtml (3373 => 3374)
--- branches/wf4ever/app/views/packs/resource_show.rhtml 2013-01-29 18:41:07 UTC (rev 3373)
+++ branches/wf4ever/app/views/packs/resource_show.rhtml 2013-01-29 18:41:16 UTC (rev 3374)
@@ -1,5 +1,13 @@
-<h1>Resource: <%=h @manifest_name -%></h1>
+<h1>
+ <%= @types and @types.first or "Resource"%>:
+ <%=h @manifest_name -%>
+
+<% if @types.length > 1 %>
+ (<%= @types[1..-1].join ", "-%>)
+<% end %>
+</h1>
+
<div style="margin-top: 1em;">
<ul class="sectionIcons" style="margin-top: 0.7em; margin-bottom: 0.6em;">
<% if Authorization.check("edit", @pack, current_user) %>