Skip to content

Commit

Permalink
add member list finder role info link (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Nov 12, 2024
1 parent 472277c commit 5865aea
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Unreleased
Added
-----

- **Projectroles**
- Info link for finder role in ``ProjectRoleView`` (#1511)
- **Timeline**
- User count in siteinfo stats (#1504)
- Plugin tests (#1506)
Expand Down
2 changes: 2 additions & 0 deletions docs/source/major_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ Release Highlights

- Add auth type in user profile details card
- Add user count in timeline siteinfo statistics
- Add finder role info link in member list
- Fix invite create view redirect failing in categories
- Fix requiring deprecated SODAR API settings in tests
- General bug fixes and minor updates


v1.0.2 (2024-09-09)
Expand Down
4 changes: 4 additions & 0 deletions projectroles/templates/projectroles/project_roles.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
{% block projectroles_extend %}

{% get_role_perms project request.user as role_perms %}
{% get_info_link finder_info as finder_info_link %}

<div class="row sodar-subtitle-container bg-white sticky-top">
<h3>
Expand Down Expand Up @@ -87,6 +88,9 @@ <h3>
{% else %}
<i class="iconify" data-icon="{% get_role_icon role_as.role %}"></i>
{{ role_display }}
{% if role_as.role.name == 'project finder' %}
{{ finder_info_link | safe }}
{% endif %}
{% endif %}
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions projectroles/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
FORM_INVALID_MSG,
PROJECT_WELCOME_MSG,
USER_PROFILE_LDAP_MSG,
ROLE_FINDER_INFO,
INVITE_LDAP_LOCAL_VIEW_MSG,
INVITE_LOCAL_NOT_ALLOWED_MSG,
INVITE_LOGGED_IN_ACCEPT_MSG,
Expand Down Expand Up @@ -2617,6 +2618,12 @@ def test_get(self):
[model_to_dict(m) for m in response.context['roles']], expected
)
self.assertNotIn('remote_role_url', response.context)
self.assertEqual(
response.context['finder_info'],
ROLE_FINDER_INFO.format(
categories='categories', projects='projects'
),
)

def test_get_not_found(self):
"""Test GET view with invalid project UUID"""
Expand Down
8 changes: 8 additions & 0 deletions projectroles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@
)
ROLE_CREATE_MSG = 'Membership granted with the role of "{role}".'
ROLE_UPDATE_MSG = 'Member role changed to "{role}".'
ROLE_FINDER_INFO = (
'User can see nested {categories} and {projects}, but can not access them '
'without having a role explicitly assigned.'
)
SEARCH_DICT_DEPRECATE_MSG = (
'Results from search() as a dict have been deprecated and support will be '
'removed in v1.1. Provide results as a list of PluginSearchResult objects '
Expand Down Expand Up @@ -1719,6 +1723,10 @@ def get_context_data(self, *args, **kwargs):
] = project.get_source_site().url + reverse(
'projectroles:roles', kwargs={'project': project.sodar_uuid}
)
context['finder_info'] = ROLE_FINDER_INFO.format(
categories=get_display_name(PROJECT_TYPE_CATEGORY, plural=True),
projects=get_display_name(PROJECT_TYPE_PROJECT, plural=True),
)
return context


Expand Down

0 comments on commit 5865aea

Please sign in to comment.