Diff
Modified: branches/packs/app/controllers/annotations_controller.rb (3791 => 3792)
--- branches/packs/app/controllers/annotations_controller.rb 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/controllers/annotations_controller.rb 2013-11-19 01:18:57 UTC (rev 3792)
@@ -56,12 +56,16 @@
graph = Pack.first.research_object.create_graph_using_ro_template(parameters, template)
- @context.research_object.create_annotation(
+ annotation = @context.research_object.create_annotation(
:body_graph => graph,
:content_type => 'application/rdf+xml',
:resources => targets,
:creator_uri => user_path(current_user))
+ unless annotation.new_record?
+ Activity.create_activities(:subject => current_user, :action ="" 'create', :object => annotation, :extra => template["label"])
+ end
+
if template["redirect"]
redirect_to resource_path_fixed(@context, @context.find_resource_by_ore_path(params[template["redirect"]]))
else
Modified: branches/packs/app/helpers/activities_helper.rb (3791 => 3792)
--- branches/packs/app/helpers/activities_helper.rb 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/helpers/activities_helper.rb 2013-11-19 01:18:57 UTC (rev 3792)
@@ -91,6 +91,7 @@
type_bits << "(activities.objekt_type = 'GroupAnnouncement' AND activities.action = '')"
type_bits << "(activities.objekt_type = 'Membership' AND activities.action = '')"
type_bits << "(activities.objekt_type = 'Resource' AND activities.action = '')"
+ type_bits << "(activities.objekt_type = 'Resource' AND activities.action = '')"
# Create the conditions
@@ -204,7 +205,9 @@
activity = activity_set.first
- case activity.objekt ? "#{activity.objekt_type} #{activity.action}" : activity.action
+ # return "#{activity.objekt_type} #{activity.action}"
+
+ case "#{activity.objekt_type} #{activity.action}"
when "Announcement create"
"#{activity_link(activity, :subject)} announced #{activity_link(activity, :object)}"
when "Announcement edit"
@@ -266,9 +269,17 @@
when "GroupAnnouncement create"
activity_link(activity, :object)
when "Resource create"
- if ore_path = activity.objekt.ore_path
- "#{activity_link(activity, :subject)} added #{activity_link(activity, :object)}"
+ if activity.objekt
+ if ore_path = activity.objekt.ore_path
+ "#{activity_link(activity, :subject)} added #{activity_link(activity, :object)}"
+ elsif activity.objekt.is_annotation?
+ "#{activity_link(activity, :subject)} added #{indefinite_article(activity.extra)} #{link_to(activity.extra, polymorphic_path([activity.objekt.research_object.context, :annotation], :id => activity.objekt.uuid))} annotation"
+ end
+ else
+ "#{activity_link(activity, :subject)} added #{h(activity.objekt_label)}"
end
+ when "Resource destroy"
+ "#{activity_link(activity, :subject)} deleted #{h(activity.objekt_label)}"
end
rescue
Modified: branches/packs/app/helpers/application_helper.rb (3791 => 3792)
--- branches/packs/app/helpers/application_helper.rb 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/helpers/application_helper.rb 2013-11-19 01:18:57 UTC (rev 3792)
@@ -1487,10 +1487,14 @@
return permissions_categorised
end
- def indefinite_article(text)
- text.match(/^[aeiou]/i) ? "an" : "a"
+ def indefinite_article(noun)
+ noun.match(/^[aeiou]/i) ? "an" : "a"
end
+ def indefinite_noun(noun)
+ "#{indefinite_article(noun)} #{noun}"
+ end
+
def comma_list(strings)
return "" if strings.empty?
Modified: branches/packs/app/models/activity.rb (3791 => 3792)
--- branches/packs/app/models/activity.rb 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/models/activity.rb 2013-11-19 01:18:57 UTC (rev 3792)
@@ -46,7 +46,7 @@
object = opts[:object]
timestamp = opts[:timestamp]
auth = nil
- extra = nil
+ extra = opts[:extra]
contexts = [subject]
priority = 0
@@ -138,9 +138,14 @@
when "Resource"
- case object.context
- when PackContributableEntry, PackRemoteEntry
- contexts << object.context.pack
+ contexts << object.research_object.context
+
+ if object.is_annotation?
+ object.annotation_targets.each do |target|
+ if target.context
+ contexts << target.context
+ end
+ end
end
auth = object
Modified: branches/packs/app/models/pack.rb (3791 => 3792)
--- branches/packs/app/models/pack.rb 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/models/pack.rb 2013-11-19 01:18:57 UTC (rev 3792)
@@ -741,8 +741,7 @@
:is_root_folder => resource.is_root_folder,
:created_at => resource.created_at,
:updated_at => resource.updated_at,
- :uuid => resource.uuid,
- :title => resource.title)
+ :uuid => resource.uuid)
resource_map[resource] = new_resource
Modified: branches/packs/app/models/resource.rb (3791 => 3792)
--- branches/packs/app/models/resource.rb 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/models/resource.rb 2013-11-19 01:18:57 UTC (rev 3792)
@@ -254,6 +254,10 @@
:conditions => { :resource_path => path }).map { |ar| ar.annotation }
end
+ def annotation_targets
+ annotation_resources.map { |ar| research_object.resources.find_by_path(ar.resource_path) }
+ end
+
def merged_annotation_graphs
result = RDF::Graph.new
Modified: branches/packs/app/views/mailer/friendship_invite_new_user.rhtml (3791 => 3792)
--- branches/packs/app/views/mailer/friendship_invite_new_user.rhtml 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/views/mailer/friendship_invite_new_user.rhtml 2013-11-19 01:18:57 UTC (rev 3792)
@@ -18,7 +18,7 @@
To become my friend you will have to follow these simple steps:
-1. Register for <%= indefinite_article(Conf.sitename) %> <%= Conf.sitename %> account at: <%= url_for : false, :controller => 'users', :host => Conf.hostname, :action ="" 'new', :token => @token %>
+1. Register for <%= indefinite_noun(Conf.sitename) %> account at: <%= url_for : false, :controller => 'users', :host => Conf.hostname, :action ="" 'new', :token => @token %>
2. Confirm your email address as instructed during the registration process.
3. Accept my friendship request that you will receive directly to your account once the registration is complete.
Modified: branches/packs/app/views/mailer/group_invite_new_user.rhtml (3791 => 3792)
--- branches/packs/app/views/mailer/group_invite_new_user.rhtml 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/views/mailer/group_invite_new_user.rhtml 2013-11-19 01:18:57 UTC (rev 3792)
@@ -20,7 +20,7 @@
To join the group you will have to follow these simple steps:
-1. Register for <%= indefinite_article(Conf.sitename) %> <%= Conf.sitename %> account at: <%= url_for : false, :controller => 'users', :host => Conf.hostname, :action ="" 'new', :token => @token %>
+1. Register for <%= indefinite_noun(Conf.sitename) %> account at: <%= url_for : false, :controller => 'users', :host => Conf.hostname, :action ="" 'new', :token => @token %>
2. Confirm your email address as instructed during the registration process.
3. Accept the group membership request that you will receive directly to your account once the registration is complete.
Modified: branches/packs/app/views/users/edit.rhtml (3791 => 3792)
--- branches/packs/app/views/users/edit.rhtml 2013-11-18 10:35:18 UTC (rev 3791)
+++ branches/packs/app/views/users/edit.rhtml 2013-11-19 01:18:57 UTC (rev 3792)
@@ -33,7 +33,7 @@
<br/>
<h2>User Authentication</h2>
<p style="text-align: center; line-height: 1.5;">
- You have two options to log in: using <%= indefinite_article(Conf.sitename) %> <%= Conf.sitename %> username and password <b>OR</b> OpenID login details.
+ You have two options to log in: using <%= indefinite_noun(Conf.sitename) %> username and password <b>OR</b> OpenID login details.
<br/>
<i>Your account can have either of these or even both registered, as below.</i>
</p>