Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions app/views/collaborations/_collaborators_button.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<% association_name = resource.class.human_attribute_name(:collaborators) %>

<%= link_to '#', class: 'btn btn-default collaborators-button',
data: { toggle: 'modal', target: '#collaborators-modal'} do %>
<i class="fa fa-users" aria-hidden="true"></i> Collaborators
<i class="fa fa-users" aria-hidden="true"></i> <%= association_name %>
<% end %>

<div class="modal fade text-left" tabindex="-1" role="dialog" aria-labelledby="collaborators-modal-title" id="collaborators-modal"
Expand All @@ -12,24 +14,23 @@
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="collaborators-modal-title">
<i class="fa fa-users" aria-hidden="true"></i> Collaborators
<i class="fa fa-users" aria-hidden="true"></i> <%= association_name %>
</h4>
</div>

<div class="modal-body">
<h4>
Current collaborators:
<%= info_button('What are collaborators?', class: 'pull-right btn-xs') do %>
Collaborators are other <%= TeSS::Config.site['title_short'] %> users who can edit this <%= resource.model_name.human %>. Only
the <%= resource.model_name.human %> owner can add and remove collaborators.
<%= t('collaborators.current', attribute: association_name) %>
<%= info_button(t('info.collaborators.title', attribute: association_name), class: 'pull-right btn-xs') do %>
<%= t('info.collaborators.description', attribute: association_name, resource_type: resource.model_name.human) %>
<% end %>
</h4>
<ul class="collaboration-list">
Loading
<%# Content inserted via javascript (see: collaborations.js %>
</ul>

<input type="text" autocomplete="off" class="form-control" id="collaborators-modal-add" placeholder="Add a new collaborator...">
<%= text_field_tag(nil, nil, autocomplete: 'off', class: 'form-control', id: 'collaborators-modal-add', placeholder: t('collaborators.add', attribute: association_name.singularize)) %>
</div>

<div class="modal-footer">
Expand Down
2 changes: 1 addition & 1 deletion app/views/learning_path_topics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<%= link_to @learning_path_topic.user.name, @learning_path_topic.user %>
</div>
<% if @learning_path_topic.collaborators.any? %>
<h4 class="nav-heading"><%= Collection.human_attribute_name(:collaborators) %></h4>
<h4 class="nav-heading"><%= LearningPathTopic.human_attribute_name(:collaborators) %></h4>
<% @learning_path_topic.collaborators.each do |collaborator| %>
<div class="nav-block">
<%= link_to collaborator.name, collaborator %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/learning_paths/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= render partial: 'nodes/partials/associated_node_info', locals: { associated_nodes: @learning_path.associated_nodes } %>
<%= render(partial: 'users/partials/user_info', locals: { user: @learning_path.user }) if current_user.try(:is_admin?) %>
<% if @learning_path.collaborators.any? %>
<h4 class="nav-heading"><%= Collection.human_attribute_name(:collaborators) %></h4>
<h4 class="nav-heading"><%= LearningPath.human_attribute_name(:collaborators) %></h4>
<% @learning_path.collaborators.each do |collaborator| %>
<div class="nav-block">
<%= link_to collaborator.name, collaborator %>
Expand Down
22 changes: 16 additions & 6 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ en:
difficulty_level: Competency level
learning_path:
difficulty_level: Competency level
collaborators: Maintainers
learning_path_topic:
difficulty_level: Competency level
collaborators: Maintainers
workflow:
difficulty_level: Competency level
about:
Expand Down Expand Up @@ -1192,11 +1194,16 @@ en:
Spaces are customizable, community-managed sub-portals within %{site_name}, each with its own catalogue of training content.
Some spaces are private. That means you can see and have access to them only if you are in at least one of the required groups for each of them.
groups:
title: What are Groups?
description: |
Groups is a feature which for now is used only to manage access of private spaces.
A user being part of a group has access to every private space which requires the group.
Each group has multiple owners. A owner can add and remove people to the group.
title: What are Groups?
description: |
Groups is a feature which for now is used only to manage access of private spaces.
A user being part of a group has access to every private space which requires the group.
Each group has multiple owners. A owner can add and remove people to the group.
Comment on lines +1199 to +1201
collaborators:
title: What are %{attribute}?
description: |
%{attribute} are other %{site_name} users who can edit this %{resource_type}. Only
the %{resource_type}owner can add and remove %{attribute}.
orcid:
error: 'An error occurred whilst trying to authenticate your ORCID.'
link: 'Link your ORCID'
Expand Down Expand Up @@ -1242,4 +1249,7 @@ en:
link: View in space
search:
errors:
filter_limit_reached: Filter limit reached, please log in to apply additional filters.
filter_limit_reached: Filter limit reached, please log in to apply additional filters.
collaborators:
current: "Current %{attribute}:"
add: Add a new %{attribute}
9 changes: 9 additions & 0 deletions test/controllers/learning_path_topics_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -602,4 +602,13 @@ class LearningPathTopicsControllerTest < ActionController::TestCase
assert_redirected_to learning_path_topic_path(assigns(:learning_path_topic))
assert_equal 'Some comment', topic_item.reload.comment
end

test 'should call collaborators maintainers' do
sign_in @learning_path_topic.user
get :show, params: { id: @learning_path_topic }
assert_response :success

assert_select '.btn[data-target="#collaborators-modal"]', text: 'Maintainers'
assert_select '#collaborators-modal .modal-header h4', text: 'Maintainers'
end
end
9 changes: 9 additions & 0 deletions test/controllers/learning_paths_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,13 @@ class LearningPathsControllerTest < ActionController::TestCase
assert assigns(:learning_path).unordered?
assert_select '.learning-path-topic.unordered', minimum: 1
end

test 'should call collaborators maintainers' do
sign_in @learning_path.user
get :show, params: { id: @learning_path }
assert_response :success

assert_select '.btn[data-target="#collaborators-modal"]', text: 'Maintainers'
assert_select '#collaborators-modal .modal-header h4', text: 'Maintainers'
end
end