diff --git a/opentech/apply/funds/tables.py b/opentech/apply/funds/tables.py index b22079eba58f91e1ffdd6c5ae8914808139d0f98..4456510530e47f6676caf9973e04d0eed9e8d320 100644 --- a/opentech/apply/funds/tables.py +++ b/opentech/apply/funds/tables.py @@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model from django.db.models import F, Q from django.utils.html import format_html from django.utils.text import mark_safe, slugify +from django.utils.translation import ugettext_lazy as _ import django_filters as filters import django_tables2 as tables @@ -49,6 +50,7 @@ class SubmissionsTable(tables.Table): 'data-record-id': lambda record: record.id, } attrs = {'class': 'all-submissions-table'} + empty_text = _('No submissions available') def render_user(self, value): return value.get_full_name() @@ -77,6 +79,11 @@ class AdminSubmissionsTable(SubmissionsTable): return format_html('<span>{}</span>', value) +class SummarySubmissionsTable(AdminSubmissionsTable): + class Meta(AdminSubmissionsTable.Meta): + orderable = False + + def get_used_rounds(request): return Round.objects.filter(submissions__isnull=False).distinct() diff --git a/opentech/apply/funds/templates/funds/base_submissions_table.html b/opentech/apply/funds/templates/funds/base_submissions_table.html index 41e9256ea4c15e28caf36130e93c45ede128395b..d9214f80da196c86ca5211367455a9e292fd1bac 100644 --- a/opentech/apply/funds/templates/funds/base_submissions_table.html +++ b/opentech/apply/funds/templates/funds/base_submissions_table.html @@ -8,8 +8,7 @@ {% block content %} {% block table %} - - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True%} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action %} {% render_table table %} {% endblock %} diff --git a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html index 3f75c443729cc802796309d7c2238955de2af8af..e4cff0f2d2f2147b94009bcebc63f27aefbe9f7f 100644 --- a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html +++ b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html @@ -18,7 +18,7 @@ <button class="filters__button js-close-filters">Close</button> </div> - <form action="" method="get" class="form form--filters js-filter-form"> + <form action="{{ filter_action }}" method="get" class="form form--filters js-filter-form"> <ul class="form__filters select2"> {{ filter.form.as_ul }} <li> diff --git a/opentech/apply/funds/templates/funds/submission_sealed.html b/opentech/apply/funds/templates/funds/submission_sealed.html index ffd8069eafd28583caab930593e2447ca2b98f4d..15976eb85070f40ec11f9d1a09f8100c41767216 100644 --- a/opentech/apply/funds/templates/funds/submission_sealed.html +++ b/opentech/apply/funds/templates/funds/submission_sealed.html @@ -18,7 +18,7 @@ <div class="wrapper wrapper--medium"> <h2 class="heading">This application is sealed until the round is closed</h2> <h3>The round ends on: {{ object.round.specific.end_date }}</h3> - <a class="button button--primary" href="{% url 'apply:submissions:list' %}">Go back</a> + <a class="button button--primary" href="{% url 'apply:submissions:overview' %}">Go back</a> {% if can_view_sealed %} <p>As an admin you are allowed to access the application. However, this action will be recorded.</p> <form method="post"> diff --git a/opentech/apply/funds/templates/funds/submissions.html b/opentech/apply/funds/templates/funds/submissions.html index 753f011935564d51a77fb2a1328421c9554cd469..353450fa78d785a9339a12023d7eb3f69c5f3736 100644 --- a/opentech/apply/funds/templates/funds/submissions.html +++ b/opentech/apply/funds/templates/funds/submissions.html @@ -7,19 +7,13 @@ <div class="admin-bar__inner wrapper--search"> {% block page_header %} <div> - <h1 class="gamma heading heading--no-margin heading--bold">Received Submissions</h1> - <h5>Track and explore recent submissions</h5> + <h1 class="gamma heading heading--no-margin heading--bold">All Submissions</h1> </div> {% endblock %} </div> </div> <div class="wrapper wrapper--large wrapper--inner-space-medium"> - - {% if closed_rounds or open_rounds %} - {% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds %} - {% endif %} - {% block table %} {{ block.super }} {% endblock %} diff --git a/opentech/apply/funds/templates/funds/submissions_by_round.html b/opentech/apply/funds/templates/funds/submissions_by_round.html index fa9d4527639ebb64a84f37bd58bbe54e05397c86..8661c28f948911a9d064c8e71eec6d21ac98e4df 100644 --- a/opentech/apply/funds/templates/funds/submissions_by_round.html +++ b/opentech/apply/funds/templates/funds/submissions_by_round.html @@ -7,7 +7,7 @@ <div class="admin-bar"> <div class="admin-bar__inner admin-bar__inner--with-button"> <div> - <h5><a href="{% url "apply:submissions:list" %}">< Submissions</a></h5> + <h5><a href="{% url "apply:submissions:overview" %}">< Submissions</a></h5> <h1 class="gamma heading heading--no-margin heading--bold">{{ object }}</h1> <h5>{% if object.fund %}{{ object.fund }} | {% endif %}Lead: {{ object.lead }}</h5> </div> diff --git a/opentech/apply/funds/templates/funds/submissions_overview.html b/opentech/apply/funds/templates/funds/submissions_overview.html new file mode 100644 index 0000000000000000000000000000000000000000..3963db804992e273f05a4202a2846aede8554c0a --- /dev/null +++ b/opentech/apply/funds/templates/funds/submissions_overview.html @@ -0,0 +1,42 @@ +{% extends "funds/base_submissions_table.html" %} +{% load static %} +{% block title %}Submissions{% endblock %} + +{% block content %} +<div class="admin-bar"> + <div class="admin-bar__inner wrapper--search"> + {% block page_header %} + <div> + <h1 class="gamma heading heading--no-margin heading--bold">Submissions</h1> + <h5>Track and explore recent submissions</h5> + </div> + {% endblock %} + </div> +</div> + +<div class="wrapper wrapper--large wrapper--inner-space-medium"> + + {% if closed_rounds or open_rounds %} + {% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds %} + {% endif %} + + {% block table %} + <h4 class="heading heading--normal heading--no-margin">All Submissions</h4> + {{ block.super }} + <div class="all-submissions-table__more"> + <a href="{% url 'apply:submissions:list' %}">Show all</a> + </div> + {% endblock %} +</div> + +<a href="#" class="js-open-feed link link--open-feed"> + <h4 class="heading heading--no-margin heading--activity-feed">Activity Feed</h4> +</a> +{% include "funds/includes/activity-feed.html" %} + +{% endblock %} + +{% block extra_js %} + {{ block.super }} + <script src="{% static 'js/apply/activity-feed.js' %}"></script> +{% endblock %} diff --git a/opentech/apply/funds/templates/funds/tables/table.html b/opentech/apply/funds/templates/funds/tables/table.html index a6f7eea2df12b4a9ff771a40e90bf7e2132a7f46..cb3095fc7f961f67e78ed0eadc73308fbf4e2f24 100644 --- a/opentech/apply/funds/templates/funds/tables/table.html +++ b/opentech/apply/funds/templates/funds/tables/table.html @@ -71,3 +71,7 @@ {% endif %} {% endblock %} + +{% block table.tbody.empty_text %} +<tr class="all-submissions-table__empty"><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr> +{% endblock table.tbody.empty_text %} diff --git a/opentech/apply/funds/urls.py b/opentech/apply/funds/urls.py index 9b9b3bded9933019885db216beb93dace5a6067b..7897ce287fc42c0919b4bbd171a1f4c9096a8ca3 100644 --- a/opentech/apply/funds/urls.py +++ b/opentech/apply/funds/urls.py @@ -8,7 +8,7 @@ from .views import ( SubmissionDetailView, SubmissionEditView, SubmissionListView, - SubmissionListAllView, + SubmissionOverviewView, SubmissionSealedView, ) from .api_views import SubmissionList, SubmissionDetail @@ -23,8 +23,8 @@ revision_urls = ([ app_name = 'funds' submission_urls = ([ - path('', SubmissionListView.as_view(), name="list"), - path('all/', SubmissionListAllView.as_view(), name="listall"), + path('', SubmissionOverviewView.as_view(), name="overview"), + path('all/', SubmissionListView.as_view(), name="list"), path('<int:pk>/', include([ path('', SubmissionDetailView.as_view(), name="detail"), path('edit/', SubmissionEditView.as_view(), name="edit"), diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py index 6c72c8b08d5a75e4cd9167bd1a59ba30e4a539f9..eb19a7e4a02686332a20ad85597a6bdc121a5372 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -37,6 +37,7 @@ from .tables import ( RoundsTable, RoundsFilter, SubmissionFilterAndSearch, + SummarySubmissionsTable, ) from .workflow import STAGE_CHANGE_ACTIONS @@ -45,6 +46,7 @@ from .workflow import STAGE_CHANGE_ACTIONS class BaseAdminSubmissionsTable(SingleTableMixin, FilterView): table_class = AdminSubmissionsTable filterset_class = SubmissionFilterAndSearch + filter_action = '' excluded_fields = [] @@ -54,8 +56,8 @@ class BaseAdminSubmissionsTable(SingleTableMixin, FilterView): 'exclude': self.excluded_fields } - def get_table_kwargs(self): - return self.excluded + def get_table_kwargs(self, **kwargs): + return {**self.excluded, **kwargs} def get_filterset_kwargs(self, filterset_class): kwargs = super().get_filterset_kwargs(filterset_class) @@ -71,13 +73,20 @@ class BaseAdminSubmissionsTable(SingleTableMixin, FilterView): search_term = self.request.GET.get('query') kwargs.update( search_term=search_term, + filter_action=self.filter_action, ) return super().get_context_data(**kwargs) -class SubmissionListView(AllActivityContextMixin, BaseAdminSubmissionsTable): - template_name = 'funds/submissions.html' +class SubmissionOverviewView(AllActivityContextMixin, BaseAdminSubmissionsTable): + template_name = 'funds/submissions_overview.html' + table_class = SummarySubmissionsTable + table_pagination = False + filter_action = reverse_lazy('funds:submissions:list') + + def get_queryset(self): + return super().get_queryset()[:5] def get_context_data(self, **kwargs): base_query = RoundsAndLabs.objects.with_progress().active().order_by('-end_date') @@ -95,7 +104,7 @@ class SubmissionListView(AllActivityContextMixin, BaseAdminSubmissionsTable): ) -class SubmissionListAllView(AllActivityContextMixin, BaseAdminSubmissionsTable): +class SubmissionListView(AllActivityContextMixin, BaseAdminSubmissionsTable): template_name = 'funds/submissions.html' diff --git a/opentech/public/navigation/templates/navigation/primarynav-apply.html b/opentech/public/navigation/templates/navigation/primarynav-apply.html index faafe645586ae3df042b0460e1bde17ff7e15ff3..7e62cc2923464e30ab34dcd3b5ec27b662f9133b 100644 --- a/opentech/public/navigation/templates/navigation/primarynav-apply.html +++ b/opentech/public/navigation/templates/navigation/primarynav-apply.html @@ -2,7 +2,7 @@ <ul class="nav nav--primary" role="menubar"> {% if request.user.is_apply_staff %} {% include "navigation/primarynav-apply-item.html" with name="Dashboard" url="dashboard:dashboard" %} - {% include "navigation/primarynav-apply-item.html" with name="Submissions" url="funds:submissions:list" %} + {% include "navigation/primarynav-apply-item.html" with name="Submissions" url="funds:submissions:overview" %} {% include "navigation/primarynav-apply-item.html" with name="Rounds" url="funds:rounds:list" %} {% else %} {% include "navigation/primarynav-apply-item.html" with name="Dashboard" url="dashboard:dashboard" %} diff --git a/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss b/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss index 4e00d921d949535c681001f3188d956264858ae8..fae5401c5bf37bd6067f631e12dfc69c61cbc573 100644 --- a/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss +++ b/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss @@ -3,6 +3,7 @@ $root: &; font-size: 14px; + thead { display: none; @@ -223,7 +224,35 @@ } } + &__empty { + text-align: center; + vertical-align: middle; + font-weight: $weight--bold; + color: $color--default; + + td { + padding: 20px; + } + } + &__toggle { padding: 5px 0 5px 5px; } + + &__more { + display: flex; + justify-content: center; + background-color: $color--white; + padding: 20px 25px; + min-height: auto; + + a { + margin: 0; + flex-basis: auto; + font-weight: $weight--semibold; + } + + } + + }