Merge pull request #2520 from urbanrotnik/ur-sci-4522-activity-links

Activities links [SCI-4522] &  [SCI-4514]
This commit is contained in:
Urban Rotnik 2020-05-06 22:11:58 +02:00 committed by GitHub
commit a38b850601
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 16 deletions

View file

@ -23,6 +23,7 @@ class ProtocolsController < ApplicationController
linked_children
linked_children_datatable
)
before_action :switch_team_with_param, only: :index
before_action :check_view_all_permissions, only: %i(
index
datatable

View file

@ -31,6 +31,7 @@ class ReportsController < ApplicationController
only: %i(new edit available_repositories)
before_action :check_manage_permissions, only: BEFORE_ACTION_METHODS
before_action :switch_team_with_param, only: :index
# Index showing all reports of a single project
def index; end

View file

@ -5,7 +5,9 @@ class RepositoriesController < ApplicationController
include ActionView::Helpers::TagHelper
include ActionView::Context
include IconsHelper
include TeamsHelper
before_action :switch_team_with_param, only: :show
before_action :load_vars,
except: %i(index create create_modal parse_sheet)
before_action :load_parent_vars, except:

View file

@ -122,10 +122,10 @@ module Users
Activities::CreateActivityService
.call(activity_type: :invite_user_to_team,
owner: current_user,
subject: current_team,
team: current_team,
subject: @team,
team: @team,
message_items: {
team: current_team.id,
team: @team.id,
user_invited: user.id,
role: user_team.role_str
})

View file

@ -42,17 +42,17 @@ module GlobalActivitiesHelper
# Not link for now
return current_value
when Team
path = projects_path
path = projects_path(team: obj.id)
when Repository
path = repository_path(obj)
path = repository_path(obj, team: obj.team.id)
when RepositoryRow
return current_value unless obj.repository
path = repository_path(obj.repository)
path = repository_path(obj.repository, team: obj.repository.team.id)
when RepositoryColumn
return current_value unless obj.repository
path = repository_path(obj.repository)
path = repository_path(obj.repository, team: obj.repository.team.id)
when Project
path = obj.archived? ? projects_path : project_path(obj)
when Experiment
@ -73,11 +73,11 @@ module GlobalActivitiesHelper
end
when Protocol
if obj.in_repository_public?
path = protocols_path(type: :public)
path = protocols_path(type: :public, team: obj.team.id)
elsif obj.in_repository_private?
path = protocols_path(type: :private)
path = protocols_path(type: :private, team: obj.team.id)
elsif obj.in_repository_archived?
path = protocols_path(type: :archive)
path = protocols_path(type: :archive, team: obj.team.id)
elsif obj.my_module.navigable?
path = protocols_my_module_path(obj.my_module)
else
@ -90,7 +90,7 @@ module GlobalActivitiesHelper
when Step
return current_value
when Report
path = reports_path
path = reports_path(team: obj.team.id)
else
return current_value
end

View file

@ -20,4 +20,8 @@ module TeamsHelper
def team_created_by(team)
User.find_by_id(team.created_by_id)
end
def switch_team_with_param
current_team_switch(Team.find_by(id: params[:team])) if params[:team]
end
end

View file

@ -3,7 +3,7 @@
<div class="ga-breadcrumb">
<span class="fas fa-clipboard-check"></span>
<% if subject %>
<%= route_to_other_team(reports_path(subject),
<%= route_to_other_team(reports_path(subject, team: subject.team.id),
team,
subject.name&.truncate(Constants::NAME_TRUNCATION_LENGTH),
title: subject.name) %>

View file

@ -3,7 +3,7 @@
<div class="ga-breadcrumb">
<span class="fas fa-list-alt"></span>
<% if subject %>
<%= route_to_other_team(repository_path(subject.id),
<%= route_to_other_team(repository_path(subject.id, team: subject.team.id),
team,
subject.name&.truncate(Constants::NAME_TRUNCATION_LENGTH),
title: subject.name) %>

View file

@ -45,9 +45,9 @@ en:
add_comment_to_project_html: "%{user} commented on project %{project}."
edit_project_comment_html: "%{user} edited comment on project %{project}."
delete_project_comment_html: "%{user} deleted comment on project %{project}."
create_report_html: "%{user} created report <strong>%{report}</strong>."
edit_report_html: "%{user} edited report <strong>%{report}</strong>."
delete_report_html: "%{user} deleted report <strong>%{report}</strong>."
create_report_html: "%{user} created report %{report}."
edit_report_html: "%{user} edited report %{report}."
delete_report_html: "%{user} deleted report %{report}."
add_result_html: "%{user} added %{type_of_result} result %{result}."
edit_result_html: "%{user} edited %{type_of_result} result %{result}."
add_comment_to_result_html: "%{user} commented on result %{result}."