-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1073 from ElixirTeSS/activities-refactor
Activities refactor
- Loading branch information
Showing
91 changed files
with
351 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
<%#= render_activities(@activities, layout: :activity) %> | ||
<h1>Activity</h1> | ||
|
||
<% @resource.activities.each do |activity| %> | ||
<div class="activity"> | ||
<%= render_activity(activity) %> | ||
</div> | ||
<% end %> | ||
<%= render_activity(@activity, layout: :activity, display: "common/#{@activity.key.split('.').last}") %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
app/views/public_activity/collection/_add_material.html.erb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
app/views/public_activity/collection/_update_parameter.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') %> <em><%= activity.parameters[:data_field] %></em>: <strong><%= activity.parameters[:data_value] %></strong> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
6 changes: 6 additions & 0 deletions
6
app/views/public_activity/common/_approval_status_changed.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
11 changes: 4 additions & 7 deletions
11
...ctivity/workflow/_modify_diagram.html.erb → ..._activity/common/_modify_diagram.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') %> <em><%= activity.parameters[:data_field] %></em>: <strong><%= activity.parameters[:data_value] %></strong> | ||
<%= t('activity.target_html', resource: activity_resource(activity)) %> | ||
<%= t('activity.timestamp', time: activity.created_at) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) -%>. |
18 changes: 18 additions & 0 deletions
18
app/views/public_activity/common/_update_parameter.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.