Skip to content

Commit

Permalink
Remove AwaitingReview view, give reviewer access to submission all (#…
Browse files Browse the repository at this point in the history
…4209)

Fixes # 4146

- [ ] Rename views all beta to views all.
- [ ] Give reviewers access to the submission all view.
- [ ] Make submission all list only reviews reviewers have access to,
including reviewers settings if set.
- [ ] Remove batch actions and review filter for reviewers.
- [ ] Remove old AwaitingReview view.
- [ ] Implement show_applicant_identity for submission all view.
  • Loading branch information
frjo authored Nov 19, 2024
1 parent 0a29107 commit 8d348f3
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 98 deletions.
6 changes: 5 additions & 1 deletion docs/user-guides/applications/submission-search.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Filtering and searching application submissions (beta)
# Filtering and searching application submissions

## Using search to filter application submissions

You can use advanced filters to search for application submissions that meet specific criteria.

- Filter open submission: `is:open`. Shows only current and active submission.
- Filter archived applications submission: `is:archived`. You must have access to archived submissions and have show archived submissions turned on.
- Filter when applications were submitted: `submitted:2023-09-01`, `submitted:>2023-01`, `submitted:<=2023`
- Filter when applications was last updated: `updated:2023-09-01`, `updated:>2023-01`, `updated:<=2023`
- Filter current submission that you are lead of: `lead:@me`.
- Filter your flagged submissions: `flagged:@me`
- Filter staff flagged submissions: `flagged:@staff`
- Filter submissions awaiting review by you: `reviewer:@me`
- Filter submissions reviewed by you: `reviewed-by:@me`


## Sharing Filters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2 class="text-xl mb-2">

{% if display_more %}
<div class="all-submissions-table__more">
<a href="{% url 'apply:submissions:awaiting_review' %}">{% trans "Show all" %}</a>
<a href="{{ awaiting_reviews.url }}?query=reviewer:@me">{% trans "Show all" %}</a>
</div>
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h3 class="text-xl mb-2">Your previous reviews</h3>
{% include "submissions/partials/submissions-inline.html" with submissions=my_reviewed.table.data row_layout="table" %}

<div class="border-x border-b flex items-center justify-center py-3 font-semibold">
<a href="{{ my_reviewed.url }}?reviewers={{ request.user.pk }}">{% trans "Show all" %}</a>
<a href="{{ my_reviewed.url }}?query=reviewed-by:@me">{% trans "Show all" %}</a>
</div>
</div>
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions hypha/apply/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def awaiting_reviews(self, submissions):
"count": count,
"display_more": count > limit,
"table": ReviewerSubmissionsTable(submissions[:limit], prefix="my-review-"),
"url": reverse("funds:submissions:list"),
}

def my_reviewed(self, submissions):
Expand Down
6 changes: 6 additions & 0 deletions hypha/apply/funds/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def can_bulk_delete_submissions(user) -> bool:
return False


def can_bulk_update_submissions(user) -> bool:
if user.is_apply_staff:
return True
return False


def get_archive_view_groups() -> list:
"""
Returns a list of groups that can view archived submissions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n querystrings %}
{% load heroicons %}
{% load i18n heroicons querystrings %}
{% load show_applicant_identity from workflow_tags %}

<div class="relative flex-wrap w-full px-2 py-1 border-t last:border-b border-x md:flex md:flex-nowrap hover:bg-gray-100">

Expand Down Expand Up @@ -73,14 +73,14 @@
<p class="m-0 text-xs">
#{{ s.public_id|default:s.id }}
submitted <relative-time datetime="{{ s.submit_time|date:"c" }}">{{ s.submit_time|date:"SHORT_DATE_FORMAT" }}</relative-time>
by <a
{% if s|show_applicant_identity:request.user %}by <a
href="{% url "apply:submissions:list" %}{% modify_query "only_query_string" "page" applicants=s.user.id %}"
hx-get="{% url "apply:submissions:list" %}{% modify_query "only_query_string" "page" applicants=s.user.id %}"
hx-target="#main"
hx-push-url="true"
hx-swap="outerHTML"
class="text-inherit hover:underline"
>{{ s.user }}</a> • {{ s.stage }} •
>{{ s.user }}</a>{% endif %} • {{ s.stage }} •


{% if 'round' not in SUBMISSIONS_TABLE_EXCLUDED_FIELDS %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n querystrings %}
{% load heroicons %}
{% load i18n heroicons querystrings %}
{% load show_applicant_identity from workflow_tags %}

<tr
class="relative px-2 py-1 border hover:bg-gray-100"
Expand Down Expand Up @@ -64,18 +64,20 @@
</td>

<td class="p-2 text-sm align-top">
<a
href="{% url "apply:submissions:list" %}{% modify_query "only_query_string" "page" applicants=s.user.id %}"
hx-get="{% url "apply:submissions:list" %}{% modify_query "only_query_string" "page" applicants=s.user.id %}"
hx-target="#main"
hx-push-url="true"
hx-swap="outerHTML"
class="text-inherit hover:underline"
>
{{ s.user }}
</a>
{% if 'organization_name' not in SUBMISSIONS_TABLE_EXCLUDED_FIELDS and s.form_data.organization_name %}
<span class="text-xs text-fg-muted"> / {{ s.form_data.organization_name }}</span>
{% if s|show_applicant_identity:request.user %}
<a
href="{% url "apply:submissions:list" %}{% modify_query "only_query_string" "page" applicants=s.user.id %}"
hx-get="{% url "apply:submissions:list" %}{% modify_query "only_query_string" "page" applicants=s.user.id %}"
hx-target="#main"
hx-push-url="true"
hx-swap="outerHTML"
class="text-inherit hover:underline"
>
{{ s.user }}
</a>
{% if 'organization_name' not in SUBMISSIONS_TABLE_EXCLUDED_FIELDS and s.form_data.organization_name %}
<span class="text-xs text-fg-muted"> / {{ s.form_data.organization_name }}</span>
{% endif %}
{% endif %}
</td>

Expand Down
18 changes: 0 additions & 18 deletions hypha/apply/funds/templates/funds/submissions_awaiting_review.html

This file was deleted.

67 changes: 47 additions & 20 deletions hypha/apply/funds/templates/submissions/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
>

{% dropdown_menu title="Filters" heading="Filter submissions" %}
<a
href="{% url "apply:submissions:list" %}?query=is:open"
hx-get="{% url "apply:submissions:list" %}?query=is:open"
hx-push-url="true"
hx-target="#main"
hx-swap="outerHTML"
class="flex {% if request.GET.query == "is:open" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
{% if request.GET.query == "is:open" %}
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
{% endif %}
{% trans "Open submissions" %} {{ request.GET.lead }}
</a>
<a
href="{% url "apply:submissions:list" %}?query=lead:@me"
hx-get="{% url "apply:submissions:list" %}?query=lead:@me"
Expand All @@ -59,7 +71,7 @@
{% if request.GET.query == "lead:@me" %}
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
{% endif %}
{% trans "Your assigned submissions" %} {{ request.GET.lead }}
{% trans "Your assigned submissions (lead)" %} {{ request.GET.lead }}
</a>
<a
href="{% url "apply:submissions:list" %}?query=flagged:@me"
Expand Down Expand Up @@ -87,7 +99,7 @@
</a>
<a
href="{% url "apply:submissions:list" %}?query=reviewer:@me"
href="{% url "apply:submissions:list" %}?query=reviewer:@me"
hx-get="{% url "apply:submissions:list" %}?query=reviewer:@me"
hx-push-url="true"
hx-target="#main"
hx-swap="outerHTML"
Expand All @@ -97,6 +109,18 @@
{% endif %}
{% trans "Awaiting your review" %}
</a>
<a
href="{% url "apply:submissions:list" %}?query=reviewed-by:@me"
hx-get="{% url "apply:submissions:list" %}?query=reviewed-by:@me"
hx-push-url="true"
hx-target="#main"
hx-swap="outerHTML"
class="flex {% if request.GET.query == "reviewed-by:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
{% if request.GET.query == "reviewed-by:@me" %}
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
{% endif %}
{% trans "Reviewed by you" %}
</a>
{% enddropdown_menu %}

{% for key, value in request.GET.items %}
Expand Down Expand Up @@ -321,19 +345,21 @@
class="sticky top-0 z-[5] mt-3 px-3 py-2 flex flex-wrap items-center justify-between border-x border-t md:gap-5 bg-gray-50 md:text-sm md:font-medium border-gray-200"
>
<span class="items-center hidden py-1 md:inline-flex">
<input
id="id_select_all"
type="checkbox"
x-ref="checkboxSelectAll"
aria-label="Select all submissions"
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
@click="toggleAllCheckboxes()"
>
<label
for="id_select_all"
x-show="!showSelectedSubmissions"
class="ms-2">{% trans "Select all" %}</label>
<span x-cloak class="ms-2" x-show="showSelectedSubmissions"> <span x-text="selectedSubmissionCount"></span> selected</span>
{% if enable_selection %}
<input
id="id_select_all"
type="checkbox"
x-ref="checkboxSelectAll"
aria-label="Select all submissions"
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
@click="toggleAllCheckboxes()"
>
<label
for="id_select_all"
x-show="!showSelectedSubmissions"
class="ms-2">{% trans "Select all" %}</label>
<span x-cloak class="ms-2" x-show="showSelectedSubmissions"> <span x-text="selectedSubmissionCount"></span> selected</span>
{% endif %}
</span>

<nav x-show="!showSelectedSubmissions"
Expand Down Expand Up @@ -438,10 +464,11 @@
{% enddropdown_menu %}
{% endif %}

{% dropdown_menu title="Reviewers" heading="Filter by Reviewer" enable_search=True position="right" %}
{% slot "url" %}{% url "apply:submissions:submenu-reviewers" %}{% remove_from_query "only_query_string" "page" %}{% endslot %}
{% enddropdown_menu %}

{% if not request.user.is_reviewer %}
{% dropdown_menu title="Reviewers" heading="Filter by Reviewer" enable_search=True position="right" %}
{% slot "url" %}{% url "apply:submissions:submenu-reviewers" %}{% remove_from_query "only_query_string" "page" %}{% endslot %}
{% enddropdown_menu %}
{% endif %}

{% dropdown_menu title="Sort" heading="Sort by" position="right" icon="arrows-up-down" %}
{% for sort_option in sort_options %}
Expand Down Expand Up @@ -517,7 +544,7 @@
class="w-full bg-white"
>
{% if submissions %}
{% include "submissions/partials/submissions-inline.html" with submissions=submissions row_layout=request.GET.format enable_selection=True %}
{% include "submissions/partials/submissions-inline.html" with submissions=submissions row_layout=request.GET.format enable_selection=enable_selection %}
{% else %}
<div class="flex flex-col items-center justify-center px-4 py-20 border-t">
<h2 class='text-2xl'>{% trans "No results matched your search" %}</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% endif %}
>
{% if row_layout != "list" %}
<div class="pt-48 -mt-48 overflow-x-scroll">
<div class="pt-48 -mt-48 overflow-x-auto">
<table class="w-full relative [&_th]:p-2 [&_td]:p-2">
<thead class="bg-gray-50 border">
<tr class="">
Expand Down
12 changes: 3 additions & 9 deletions hypha/apply/funds/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from hypha.apply.projects import urls as projects_urls

from .views import (
AwaitingReviewSubmissionsListView,
CreateProjectView,
GroupingApplicationsListView,
ProgressSubmissionView,
Expand Down Expand Up @@ -35,11 +34,11 @@
reminder_list,
submission_success,
)
from .views_beta import (
from .views_all import (
bulk_archive_submissions,
bulk_delete_submissions,
bulk_update_submissions_status,
submission_all_beta,
submissions_all,
)
from .views_partials import (
get_applications_status_counts,
Expand Down Expand Up @@ -91,7 +90,7 @@
name="overview",
),
path("success/<int:pk>/", submission_success, name="success"),
path("all/", submission_all_beta, name="list"),
path("all/", submissions_all, name="list"),
path("all/old/", SubmissionListView.as_view(), name="list-old"),
path(
"statuses/",
Expand Down Expand Up @@ -156,11 +155,6 @@
]
),
),
path(
"awaiting_review/",
AwaitingReviewSubmissionsListView.as_view(),
name="awaiting_review",
),
path(
"assignments/",
include(
Expand Down
24 changes: 0 additions & 24 deletions hypha/apply/funds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,30 +439,6 @@ def get_queryset(self):
return super().get_queryset().reviewed_by(self.request.user)


@method_decorator(login_required, name="dispatch")
class AwaitingReviewSubmissionsListView(SingleTableMixin, ListView):
model = ApplicationSubmission
table_class = AdminSubmissionsTable
template_name = "funds/submissions_awaiting_review.html"
paginator_class = LazyPaginator
table_pagination = {"per_page": 25}

excluded_fields = settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS

@property
def excluded(self):
return {"exclude": self.excluded_fields}

def get_table_kwargs(self, **kwargs):
return {**self.excluded, **kwargs}

def get_queryset(self):
submissions = ApplicationSubmission.objects.in_review_for(
self.request.user
).order_by("-submit_time")
return submissions.for_table(self.request.user)


class SubmissionAdminListView(BaseAdminSubmissionsTable, DelegateableListView):
template_name = "funds/submissions.html"
form_views = [
Expand Down
Loading

0 comments on commit 8d348f3

Please sign in to comment.