-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# The helper for PublicActivity | ||
|
||
module ActivityHelper | ||
def activity_owner(activity) | ||
if activity.owner | ||
link_to activity.owner.username, activity.owner | ||
else | ||
t('activity.deleted_owner') | ||
end | ||
end | ||
|
||
def activity_resource(activity) | ||
if activity.trackable | ||
title_field = activity.trackable.is_a?(User) ? :name : :title | ||
link_to activity.trackable.send(title_field), activity.trackable | ||
else | ||
t('activity.deleted_trackable') | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
<%# Activity log partial that renders activity log for a resource. | ||
Variables that should be available | ||
- resource - resource whose activity log is being displayed (a material, a content provider, etc...) | ||
%> | ||
<% unless resource.blank? %> | ||
<div class="activity"> | ||
<% if resource.activities.blank? %> | ||
<p class="empty">No activities recorded.</p> | ||
<% else %> | ||
<% resource.activities.order(created_at: :desc).each do |activity| %> | ||
<%= render_activity(activity, layout: :activity) %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<%# Activity log partial that renders activity log for a resource.%> | ||
<% if activities.blank? %> | ||
<p class="empty"><%= t('activity.empty') %></p> | ||
<% else %> | ||
<% activities.each do |activity| %> | ||
<%= render_activity(activity, layout: :activity, display: "common/#{activity.key.split('.').last}") %> | ||
<% end %> | ||
<% end %> |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.data_suggestion_add') %> <b><%= activity.parameters[:name] %></b> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.add') %> <%= Event.model_name.human.downcase %> <%= link_to activity.parameters[:event_title], | ||
event_path(activity.parameters[:event_id]) %> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% type = activity.parameters[:resource_type].constantize %> | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.add') %> <%= type.model_name.human.downcase %> <%= link_to activity.parameters[:resource_title], | ||
polymorphic_path(type.model_name.singular.to_sym, | ||
id: activity.parameters[:resource_id]) %> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.add') %> <%= Material.model_name.human.downcase %> <%= link_to activity.parameters[:material_title], | ||
material_path(activity.parameters[:material_id]) %> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.term_suggestion_add', field: activity.parameters[:field].try(:singularize)) %> <b><%= activity.parameters[:name] %></b> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<% return unless activity.parameters.present? %> | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.add') %> <%= activity_resource(activity) %> | ||
<%= t('activity.target_html', resource: link_to(activity.parameters[:collection_title], collection_path(activity.parameters[:collection_id]))) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<% return unless activity.parameters.present? %> | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.add') %> <%= activity_resource(activity) %> | ||
<%= t('activity.target_html', resource: link_to(activity.parameters[:topic_title], learning_path_topic_path(activity.parameters[:topic_id]))) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.add_topic_html', | ||
resource: activity_resource(activity), | ||
topic: link_to(activity.parameters[:topic_title], learning_path_topic_path(activity.parameters[:topic_id]))) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.approval_status_change_html', | ||
source: activity_resource(activity), | ||
status: source_approval_badge(activity.parameters[:new])) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.change_role_html', | ||
user: activity_resource(activity), | ||
old: Role.find_by_id(activity.parameters[:old])&.title || activity.parameters[:old], | ||
new: Role.find_by_id(activity.parameters[:new])&.title || activity.parameters[:new]) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<i class="fa fa-plus-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.create') %> <%= activity_resource(activity) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<i class="fa fa-trash-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.destroy') %> <%= activity_resource(activity) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<i class="fa fa-trash-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.data_suggestion_reject') %> <b><%= activity.parameters[:name] %></b> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<i class="fa fa-trash-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.term_suggestion_reject', field: activity.parameters[:field].try(:singularize)) %> <b><%= activity.parameters[:name] %></b> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.report') %> <%= activity_resource(activity) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<i class="fa fa-pencil-square-o"></i> | ||
<%= activity_owner(activity) %> | ||
<%= t('activity.actions.update') %> <%= activity_resource(activity) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% parameters = activity.parameters %> | ||
<% return if parameters.empty? %> | ||
<% return if activity.trackable.is_a?(Event) && | ||
Event::SENSITIVE_FIELDS.include?(parameters[:attr].to_sym) && | ||
!policy(activity.trackable).edit_report? %> | ||
|
||
<div class="sub-activity"> | ||
<% if parameters[:association_name] -%> | ||
<%= t('activity.actions.association_change_html', | ||
parameter: parameters[:attr].humanize, | ||
name: parameters[:association_name], | ||
value: parameters[:new_val]) %> | ||
<% else %> | ||
<%= t('activity.actions.parameter_change_html', | ||
parameter: parameters[:attr].humanize, | ||
value: parameters[:new_val]) %> | ||
<% end %> | ||
</div> |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.