diff --git a/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html b/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html index 609bf94924..6c0654e5be 100644 --- a/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html @@ -35,7 +35,7 @@ {% if my_reviewed.display_more %}
- {% trans "Show all" %} + {% trans "Show all" %}
{% endif %} @@ -77,6 +77,20 @@

{% render_table my_inactive_submissions %} {% endif %} + + {% if all_submissions.table.data %} +
+ +

{% trans "All Submissions" %}

+ {% render_table all_submissions.table %} + + {% if all_submissions.display_more %} + + {% endif %} +
+ {% endif %} {% endblock %} diff --git a/hypha/apply/dashboard/views.py b/hypha/apply/dashboard/views.py index 2edd5e9a24..c9ac4236f9 100644 --- a/hypha/apply/dashboard/views.py +++ b/hypha/apply/dashboard/views.py @@ -1,4 +1,5 @@ from django.conf import settings +from django.db.models import F from django.http import HttpResponseForbidden, HttpResponseRedirect from django.shortcuts import render from django.urls import reverse, reverse_lazy @@ -317,11 +318,22 @@ def get_context_data(self, **kwargs): "awaiting_reviews": self.awaiting_reviews(submissions), "my_reviewed": self.my_reviewed(submissions), "my_flagged": self.my_flagged(submissions), + "all_submissions": self.all_submissions(submissions), } ) return context + def all_submissions(self, submissions): + limit = 5 + submissions = submissions.order_by(F("last_update").desc(nulls_last=True)) + + return { + "table": ReviewerSubmissionsTable(submissions[:limit], prefix="my-review-"), + "display_more": submissions.count() > limit, + "url": reverse("funds:submissions:list"), + } + def awaiting_reviews(self, submissions): submissions = submissions.in_review_for(self.request.user).order_by( "-submit_time" @@ -354,7 +366,7 @@ def my_reviewed(self, submissions): ), "table": ReviewerSubmissionsTable(submissions[:limit], prefix="my-review-"), "display_more": submissions.count() > limit, - "url": reverse("funds:submissions:list"), + "url": reverse("funds:submissions:my_reviewed"), } diff --git a/hypha/apply/funds/templates/funds/submissions.html b/hypha/apply/funds/templates/funds/submissions.html index 8c7dc6bfe7..95d31afad2 100644 --- a/hypha/apply/funds/templates/funds/submissions.html +++ b/hypha/apply/funds/templates/funds/submissions.html @@ -8,7 +8,12 @@ {% adminbar %} {% slot header %} - {% trans "All Submissions" %} ({{ table.rows|length }}) + {% if page_heading %} + {{ page_heading }} + {% else %} + {% trans "All Submissions" %} + {% endif %} + ({{ table.rows|length }}) {% endslot %} {% slot sub_heading %}{% trans "Search and filter all submissions" %}{% endslot %} diff --git a/hypha/apply/funds/urls.py b/hypha/apply/funds/urls.py index da8e5bd0a2..0445a54fbd 100644 --- a/hypha/apply/funds/urls.py +++ b/hypha/apply/funds/urls.py @@ -8,6 +8,7 @@ AwaitingReviewSubmissionsListView, ExportSubmissionsByRound, GroupingApplicationsListView, + MyReviewedSubmissionListView, ReminderDeleteView, ReviewerLeaderboard, ReviewerLeaderboardDetail, @@ -167,6 +168,9 @@ AwaitingReviewSubmissionsListView.as_view(), name="awaiting_review", ), + path( + "my_reviewed/", MyReviewedSubmissionListView.as_view(), name="my_reviewed" + ), path( "assignments/", include( diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 429e7cfe7a..d81c9a9187 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -404,11 +404,6 @@ class BaseReviewerSubmissionsTable(BaseAdminSubmissionsTable): filterset_class = SubmissionReviewerFilterAndSearch def get_queryset(self): - """ - If use_settings variable is set for ReviewerSettings use settings - parameters to filter submissions or return only reviewed_by as it - was by default. - """ reviewer_settings = ReviewerSettings.for_request(self.request) if reviewer_settings.use_settings: return ( @@ -419,6 +414,9 @@ def get_queryset(self): ) return super().get_queryset().reviewed_by(self.request.user) + def get_context_data(self, **kwargs): + return super().get_context_data(page_heading="My Reviewed", **kwargs) + @method_decorator(login_required, name="dispatch") class AwaitingReviewSubmissionsListView(SingleTableMixin, ListView): @@ -581,13 +579,13 @@ class GroupingApplicationsListView(TemplateView): template_name = "funds/grouped_application_list.html" -class SubmissionReviewerListView(BaseReviewerSubmissionsTable): +class MyReviewedSubmissionListView(BaseReviewerSubmissionsTable): template_name = "funds/submissions.html" class SubmissionListView(ViewDispatcher): admin_view = SubmissionAdminListView - reviewer_view = SubmissionReviewerListView + reviewer_view = SubmissionAdminListView @method_decorator(staff_required, name="dispatch")