Skip to content

Commit

Permalink
Show primary cdsa link on CDSAWorkspace detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
amstilp committed Mar 21, 2024
1 parent 670b01a commit 37d47e9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
24 changes: 24 additions & 0 deletions primed/cdsa/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7620,6 +7620,30 @@ def test_response_requires_study_review_false(self):
response = self.client.get(instance.get_absolute_url())
self.assertNotContains(response, "Study review required")

def test_response_primary_cdsa(self):
"""Response includes note about missing primary cdsa about study review required if true."""
agreement = factories.DataAffiliateAgreementFactory.create(
is_primary=True,
)
instance = factories.CDSAWorkspaceFactory.create(
study=agreement.study,
)
self.client.force_login(self.user)
response = self.client.get(instance.get_absolute_url())
self.assertContains(response, agreement.get_absolute_url())

def test_response_no_primary_cdsa(self):
"""Response includes note about missing primary cdsa about study review required if true."""
instance = factories.CDSAWorkspaceFactory.create()
self.client.force_login(self.user)
response = self.client.get(instance.get_absolute_url())
self.assertContains(
response,
# """<dt class="col-sm-2">Associated CDSA</dt><dd class="col-sm-9">mdash;</dd>"""
"""No primary CDSA"""
# """<dt class="col-sm-2">Associated CDSA</dt> <dd class="col-sm-9">&mdash;</dd>""", # noqa: E501
)


class CDSAWorkspaceCreateTest(AnVILAPIMockTestMixin, TestCase):
"""Tests of the WorkspaceCreate view from ACM with this app's CDSAWorkspace model."""
Expand Down
19 changes: 18 additions & 1 deletion primed/templates/cdsa/cdsaworkspace_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
{% include "snippets/gsr_restricted_badge.html" %}
{% endif %}

{% if primary_cdsa.requires_study_review %}
{% if not primary_cdsa %}
<span class="badge bg-danger">
<span class="me-2 fa-solid fa-circle-exclamation"></span>
No primary CDSA
<span class="ms-2 fa-solid fa-circle-question"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
data-bs-title="No active primary CDSA exists for this study."
></span>
</span>
{% elif primary_cdsa.requires_study_review %}
<span class="badge bg-warning text-dark">
<span class="me-2 fa-solid fa-clipboard-check"></span>
Study review required
Expand All @@ -24,6 +34,13 @@
{% block workspace_data %}
<dl class="row">
<hr>
<dt class="col-sm-2">Associated CDSA</dt><dd class="col-sm-9">
{% if primary_cdsa %}
<a href="{{ primary_cdsa.get_absolute_url }}">{{ primary_cdsa }}</a>
{% else %}
&mdash;
{% endif %}
</dd>
<dt class="col-sm-2">Study</dt> <dd class="col-sm-9">
<a href="{{ object.cdsaworkspace.study.get_absolute_url }}">{{ object.cdsaworkspace.study }}</a>
</dd>
Expand Down

0 comments on commit 37d47e9

Please sign in to comment.