Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/enhancement/project_submission_t…
Browse files Browse the repository at this point in the history
…abs' into test
  • Loading branch information
frjo committed Nov 25, 2024
2 parents 5b96101 + d5e4ee4 commit d9d9072
Show file tree
Hide file tree
Showing 29 changed files with 169 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

{% trans "Title" %}: {{ source.title }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

{% trans "Title" %}: {{ source.title }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

{% trans "Title" %}: {{ source.title }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
{% trans "Title" %}: {{ source.title }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:detail' pk=source.pk %}
{% trans "Project Form" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

{% trans "Title" %}: {{ source.title }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block content %}
{% adminbar %}
{% slot back_link %}
<a class="simplified__submissions-link" href="{{ determination.submission.get_absolute_url }}">
<a class="admin-bar__back-link" href="{{ determination.submission.get_absolute_url }}">
{% trans "View submission" %}
</a>
{% endslot %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="admin-bar">
<div class="admin-bar__inner">
{% if request.GET.ref == 'all-alt' %}
<a class="simplified__submissions-link"
<a class="admin-bar__back-link"
hx-boost="true"
href="{% url "funds:submissions:list" %}"
>
Expand Down Expand Up @@ -48,7 +48,7 @@ <h1 class="mt-2 mb-0 font-medium">
<div class="tabs js-tabs">
<div class="tabs__container">
<a class="tab__item" href="#submission-details" data-tab="tab-1">
{% trans "Submission details" %}
{% trans "Application" %}
</a>

<a class="tab__item"
Expand All @@ -60,12 +60,13 @@ <h1 class="mt-2 mb-0 font-medium">
{% trans "Conversations" %} ({{ comments_count }})
</a>

<a class="tab__item"
href="#activity-feed"
data-tab="tab-3"
>
{% trans "Activity feed" %}
</a>
{% if object.project and PROJECTS_ENABLED %}
<a class="tab__item js-tabs-off"
href="{% url 'apply:projects:detail' pk=object.project.id %}"
>
{% trans "Project" %}
</a>
{% endif %}
{# is_staff is only used for Django Admin. #}
{% if request.user.is_staff %}
<a class="tab__item tab__item--right js-tabs-off" href="{% url 'admin:activity_event_changelist' %}?submission__id={{ object.id }}">
Expand Down Expand Up @@ -166,10 +167,6 @@ <h5>{% blocktrans with stage=object.previous.stage %}Your {{ stage }} applicatio
{% include "funds/includes/generic_primary_actions.html" %}
{% endblock %}

{% if object.project and PROJECTS_ENABLED %}
{% include 'funds/includes/project_block.html' %}
{% endif %}

{% block screening_status %}
{% endblock %}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ <h5>{% trans "Actions to take" %}</h5>
hx-target="#htmx-modal"
>{% trans "Create Reminder" %}</button>

<a class="button button--white button--full-width button--bottom-space"
href="{% url "apply:submissions:download" pk=object.pk %}"
>
{% trans "Download PDF" %}
</a>

{% if can_archive %}
<button class="button button--white button--full-width button--bottom-space" hx-get="{% url 'funds:submissions:archive' pk=object.pk %}" hx-target="#htmx-modal">
{% heroicon_outline "lock-closed" aria_hidden="true" size=15 stroke_width=2 class="inline align-baseline me-1" %}
Expand Down
7 changes: 0 additions & 7 deletions hypha/apply/funds/templates/funds/includes/project_block.html

This file was deleted.

2 changes: 1 addition & 1 deletion hypha/apply/funds/templates/funds/revisions_compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% adminbar %}
{% slot back_link %}
<a class="simplified__submissions-link" href="{% url "funds:submissions:revisions:list" object.id %}">
<a class="admin-bar__back-link" href="{% url "funds:submissions:revisions:list" object.id %}">
{% trans "View revisions" %}
</a>
{% endslot %}
Expand Down
34 changes: 1 addition & 33 deletions hypha/apply/funds/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import RequestFactory, TestCase, override_settings
from django.urls import reverse
Expand Down Expand Up @@ -48,7 +47,7 @@
ReviewerSettings,
ScreeningStatus,
)
from ..views import SubmissionDetailSimplifiedView, SubmissionDetailView
from ..views import SubmissionDetailView
from .factories import CustomFormFieldsFactory


Expand Down Expand Up @@ -1713,37 +1712,6 @@ def test_can_screen_applications_in_final_status(self):
self.assertEqual(activity.visibility, TEAM)


class TestSubmissionDetailSimplifiedView(TestCase):
def test_staff_only(self):
factory = RequestFactory()
submission = ApplicationSubmissionFactory()
ProjectFactory(submission=submission)

request = factory.get(f"/submission/{submission.pk}")
request.user = StaffFactory()

response = SubmissionDetailSimplifiedView.as_view()(request, pk=submission.pk)
self.assertEqual(response.status_code, 200)

request.user = ApplicantFactory()
with self.assertRaises(PermissionDenied):
SubmissionDetailSimplifiedView.as_view()(request, pk=submission.pk)

def test_project_required(self):
factory = RequestFactory()
submission = ApplicationSubmissionFactory()

request = factory.get(f"/submission/{submission.pk}")
request.user = StaffFactory()

with self.assertRaises(Http404):
SubmissionDetailSimplifiedView.as_view()(request, pk=submission.pk)

ProjectFactory(submission=submission)
response = SubmissionDetailSimplifiedView.as_view()(request, pk=submission.pk)
self.assertEqual(response.status_code, 200)


class BaseSubmissionFileViewTestCase(BaseViewTestCase):
url_name = "funds:submissions:{}"
base_view_name = "serve_private_media"
Expand Down
6 changes: 0 additions & 6 deletions hypha/apply/funds/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
StaffAssignments,
SubmissionDeleteView,
SubmissionDetailPDFView,
SubmissionDetailSimplifiedView,
SubmissionDetailView,
SubmissionEditView,
SubmissionListView,
Expand Down Expand Up @@ -249,11 +248,6 @@
),
path("edit/", SubmissionEditView.as_view(), name="edit"),
path("sealed/", SubmissionSealedView.as_view(), name="sealed"),
path(
"simplified/",
SubmissionDetailSimplifiedView.as_view(),
name="simplified",
),
path(
"download/", SubmissionDetailPDFView.as_view(), name="download"
),
Expand Down
14 changes: 0 additions & 14 deletions hypha/apply/funds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1809,20 +1809,6 @@ def test_func(self):
return permission


@method_decorator(staff_or_finance_required, name="dispatch")
class SubmissionDetailSimplifiedView(DetailView):
model = ApplicationSubmission
template_name_suffix = "_simplified_detail"

def get_object(self, queryset=None):
obj = super().get_object(queryset)

if not hasattr(obj, "project"):
raise Http404

return obj


@method_decorator(staff_or_finance_required, name="dispatch")
class SubmissionDetailPDFView(SingleObjectMixin, View):
model = ApplicationSubmission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,6 @@ <h2 class="text-lg font-semibold m-0">
<ul class="docs-block__inner" id="project-documents-elements" {% if collapsible_header %} x-show="!collapsed" role="region"
aria-labelledby="project-documents-section" {% endif %}>

<li class="docs-block__row">
<div class="docs-block__row-inner">
{% heroicon_outline "check-circle" class="stroke-light-blue me-1" aria_hidden=true %}
<p class="docs-block__title">{% trans "Proposal" %}</p>
</div>
<div class="docs-block__row-inner">
<a class="docs-block__icon-link hover:opacity-70 transition-opacity"
href="{% if user.is_applicant %}{{ project.submission.get_absolute_url }}{% else %}{% url 'apply:submissions:simplified' pk=project.submission.pk %}{% endif %}"
>
{% heroicon_micro "eye" class="inline me-1 w-4 h-4" aria_hidden=true %}
{% trans "View" %}
</a>
</div>
</li>

<li class="docs-block__row">
<div class="docs-block__row-inner">
{% if object.user_has_updated_details %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{% adminbar %}
{% slot back_link %}
<a class="simplified__projects-link" href="{{ object.project.get_absolute_url }}">
<a class="admin-bar__back-link" href="{{ object.project.get_absolute_url }}">
{% trans "View project page" %}
</a>
{% endslot %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{% adminbar %}
{% slot back_link %}
<a class="simplified__projects-link" href="{% url 'apply:projects:detail' object.project.id %}">
<a class="admin-bar__back-link" href="{% url 'apply:projects:detail' object.project.id %}">
{% trans "View project page" %}
</a>
{% endslot %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% adminbar %}
{% slot back_link %}
<a class="simplified__projects-link" href="{{ project.get_absolute_url }}">
<a class="admin-bar__back-link" href="{{ project.get_absolute_url }}">
{% trans "View project page" %}
</a>
{% endslot %}
Expand Down
Loading

0 comments on commit d9d9072

Please sign in to comment.