Modified: branches/components/app/helpers/application_helper.rb (3244 => 3245)
--- branches/components/app/helpers/application_helper.rb 2012-12-10 09:41:29 UTC (rev 3244)
+++ branches/components/app/helpers/application_helper.rb 2012-12-10 10:47:28 UTC (rev 3245)
@@ -230,25 +230,14 @@
link_to("Request Friendship", new_user_friendship_url(:user_id => user_id))
end
- def versioned_workflow_link(workflow_id, version_number, long_description=true)
- if workflow_id.kind_of? Fixnum
- workflow = Workflow.find(:first, :conditions => ["id = ?", workflow_id])
- return nil unless workflow
- elsif workflow_id.kind_of? Workflow
- workflow = workflow_id
+ def versioned_resource_link(resource, version_number, long_description=true)
+ ver = resource.find_version(version_number)
+ if ver
+ url = "" :version => version_number)
else
return nil
end
- if (ver = workflow.find_version(version_number))
- url = "" => 'workflows',
- :action ="" 'show',
- :id => workflow.id,
- :version => version_number)
- else
- return nil
- end
-
return nil unless url
if long_description
@@ -1485,7 +1474,7 @@
next unless (workflow.contributor_type.to_s == restrict_contributor.class.to_s and workflow.contributor_id.to_i == restrict_contributor.id.to_i)
end
- rtn << [workflow.updated_at, "#{editor} edited the #{versioned_workflow_link(item.id, workflow.version, false)} Workflow."]
+ rtn << [workflow.updated_at, "#{editor} edited the #{versioned_resource_link(item, workflow.version, false)} Workflow."]
end
when "PictureSelection"
return rtn if before and item.created_at > before
Modified: branches/components/app/views/packs/_items.rhtml (3244 => 3245)
--- branches/components/app/views/packs/_items.rhtml 2012-12-10 09:41:29 UTC (rev 3244)
+++ branches/components/app/views/packs/_items.rhtml 2012-12-10 10:47:28 UTC (rev 3245)
@@ -37,8 +37,7 @@
<b><%= visible_name(e.contributable_type) -%>:</b>
<% unless e.contributable_version.blank? -%>
- <% # HACK: only workflows are versioned at the moment -%>
- <%= versioned_workflow_link e.contributable_id, e.contributable_version, false -%>
+ <%= versioned_resource_link e.contributable, e.contributable_version, false -%>
<% if false %><span style="color: #666666;">(version <%= e.contributable_version -%>)</span><% end %>
<% else -%>
<%= contributable(e.contributable_id, e.contributable_type) %>
Modified: branches/components/lib/rest.rb (3244 => 3245)
--- branches/components/lib/rest.rb 2012-12-10 09:41:29 UTC (rev 3244)
+++ branches/components/lib/rest.rb 2012-12-10 10:47:28 UTC (rev 3245)
@@ -695,6 +695,7 @@
when 'Tagging'; return nil
when 'WorkflowVersion'; return "#{rest_resource_uri(ob.workflow)}?version=#{ob.version}"
+ when 'BlobVersion'; return "#{rest_resource_uri(ob.blob)}?version=#{ob.version}"
end
raise "Class not processed in rest_resource_uri: #{ob.class.to_s}"