diff --git a/opentech/apply/dashboard/templates/dashboard/dashboard.html b/opentech/apply/dashboard/templates/dashboard/dashboard.html index 535b01f95de65c62eec5e79c42c293ed9778c8d8..bc4cb7267c30131a12365bd051dfe40326452656 100644 --- a/opentech/apply/dashboard/templates/dashboard/dashboard.html +++ b/opentech/apply/dashboard/templates/dashboard/dashboard.html @@ -22,36 +22,27 @@ </div> <div class="wrapper wrapper--large wrapper--inner-space-medium"> - <div> - - {% include "dashboard/includes/waiting-for-review.html" with in_review_count=in_review_count my_review=my_review display_more=display_more %} - - - {% if closed_rounds or open_rounds %} - {% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds title=rounds_title %} - {% endif %} - - </div> - - <div> - {% if my_reviewed.data %} + <div class="wrapper wrapper--bottom-space"> + {% include "dashboard/includes/waiting-for-review.html" with in_review_count=in_review_count my_review=my_review display_more=display_more %} + </div> - <h4 class="heading heading--normal"> - Your previous reviews - </h4> + {% if closed_rounds or open_rounds %} + {% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds title=rounds_title %} + {% endif %} - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True %} - {% render_table my_reviewed %} + {% if my_reviewed.data %} + <div class="wrapper wrapper--bottom-space"> - {% if display_more_reviewed %} - <div class="all-submissions-table__more"> - <a href="{% url 'apply:submissions:list' %}?reviewers={{ request.user.pk }}">Show all</a> - </div> - {% endif %} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True use_batch_actions=False heading="Your previous reviews" %} + {% render_table my_reviewed %} + {% if display_more_reviewed %} + <div class="all-submissions-table__more"> + <a href="{% url 'apply:submissions:list' %}?reviewers={{ request.user.pk }}">Show all</a> + </div> {% endif %} </div> - + {% endif %} </div> {% endblock %} diff --git a/opentech/apply/dashboard/templates/dashboard/reviewer_dashboard.html b/opentech/apply/dashboard/templates/dashboard/reviewer_dashboard.html index cbbbce4ea416cb9a6d8a0ec44defea4ac28ec9c0..e1fc625c7101653efe990e4984457848aaadba12 100644 --- a/opentech/apply/dashboard/templates/dashboard/reviewer_dashboard.html +++ b/opentech/apply/dashboard/templates/dashboard/reviewer_dashboard.html @@ -19,20 +19,13 @@ <div class="wrapper wrapper--large wrapper--inner-space-medium"> - <div> - + <div class="wrapper wrapper--bottom-space"> {% include "dashboard/includes/waiting-for-review.html" with in_review_count=in_review_count my_review=my_review display_more=display_more %} - </div> - <div> + <div class="wrapper wrapper--bottom-space"> {% if my_reviewed.data %} - - <h4 class="heading heading--normal"> - Your previous reviews - </h4> - - {% 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 use_batch_actions=False heading="Your previous reviews" %} {% render_table my_reviewed %} {% if display_more_reviewed %} diff --git a/opentech/apply/dashboard/views.py b/opentech/apply/dashboard/views.py index cd83dc6828e37c53ee90544e77d2d322a3c9d056..99bce4e6ce3651ff88685f1e20c015b5af33e409 100644 --- a/opentech/apply/dashboard/views.py +++ b/opentech/apply/dashboard/views.py @@ -11,6 +11,7 @@ from opentech.apply.funds.tables import ( SubmissionReviewerFilterAndSearch, SubmissionsTable, SummarySubmissionsTable, + SummarySubmissionsTableWithRole, ) from opentech.apply.utils.views import ViewDispatcher @@ -57,7 +58,7 @@ class AdminDashboardView(TemplateView): def get_my_reviews(self, user, qs): my_review_qs = qs.in_review_for(user).order_by('-submit_time') - my_review_table = SummarySubmissionsTable(my_review_qs[:5], prefix='my-review-') + my_review_table = SummarySubmissionsTableWithRole(my_review_qs[:5], prefix='my-review-') display_more = (my_review_qs.count() > 5) return my_review_qs, my_review_table, display_more diff --git a/opentech/apply/funds/models/submissions.py b/opentech/apply/funds/models/submissions.py index 0e1f7d50cb36be9533e8b4d7f37f82b8ce40f806..04589f698ea5e8ac6dae409a9e68e73219d08c8a 100644 --- a/opentech/apply/funds/models/submissions.py +++ b/opentech/apply/funds/models/submissions.py @@ -101,6 +101,8 @@ class ApplicationSubmissionQueryset(JSONOrderable): activities = self.model.activities.field.model latest_activity = activities.objects.filter(submission=OuterRef('id')).select_related('user') comments = activities.comments.filter(submission=OuterRef('id')).visible_to(user) + roles_for_review = self.model.assigned.field.model.objects.with_roles().filter( + submission=OuterRef('id'), reviewer=user) reviews = self.model.reviews.field.model.objects.filter(submission=OuterRef('id')) @@ -130,6 +132,7 @@ class ApplicationSubmissionQueryset(JSONOrderable): reviews.submitted().values('submission').annotate(calc_recommendation=Sum('recommendation') / Count('recommendation')).values('calc_recommendation'), output_field=IntegerField(), ), + role_icon=Subquery(roles_for_review[:1].values('role__icon')), ).prefetch_related( 'reviews__author' ).select_related( @@ -687,6 +690,10 @@ class AssignedReviewersQuerySet(models.QuerySet): def without_roles(self): return self.filter(role__isnull=True) + def staff(self): + User = get_user_model() + return self.filter(reviewer__in=User.objects.staff()) + class AssignedReviewers(models.Model): reviewer = models.ForeignKey( diff --git a/opentech/apply/funds/tables.py b/opentech/apply/funds/tables.py index 620040584ec9b00af6ec9de12566ffe2ba00d095..a515aa6b5cff5c9fa3341424eff3433f725e74d1 100644 --- a/opentech/apply/funds/tables.py +++ b/opentech/apply/funds/tables.py @@ -115,6 +115,31 @@ class SummarySubmissionsTable(BaseAdminSubmissionsTable): orderable = False +class SummarySubmissionsTableWithRole(BaseAdminSubmissionsTable): + """ Adds Role Assigned to the 'Waiting for My Review' table """ + role_icon = tables.Column(verbose_name="Role") + + class Meta(BaseAdminSubmissionsTable.Meta): + sequence = ('...', 'role_icon', 'comments') + orderable = False + + def render_role_icon(self, value): + from django.urls import reverse + from wagtail.images.views.serve import generate_signature + from opentech.images.models import CustomImage + + if value: + image = CustomImage.objects.filter(id=value).first() + if image: + filter_spec = 'fill-20x20' + signature = generate_signature(image.id, filter_spec) + url = reverse('wagtailimages_serve', args=(signature, image.id, filter_spec)) + url += image.file.name[len('original_images/'):] + return format_html(f'<img alt="{image.title}" height="20" width="20" src="{url}">') + + return '' + + 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 322a4dca51c1d0a1b9c8aaf5e03531a308549429..6b6e6d4763412ff71ed8510cbe604ee26db1417c 100644 --- a/opentech/apply/funds/templates/funds/base_submissions_table.html +++ b/opentech/apply/funds/templates/funds/base_submissions_table.html @@ -9,7 +9,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 filter_action=filter_action %} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action use_batch_actions=True %} {% render_table table %} {% endblock %} diff --git a/opentech/apply/funds/templates/funds/includes/review_table.html b/opentech/apply/funds/templates/funds/includes/review_table.html index cacd82ba33e77deae9332d836e639a98d5aa2ef6..ef85008ac12605eb1e73e7b6b318644b97d77355 100644 --- a/opentech/apply/funds/templates/funds/includes/review_table.html +++ b/opentech/apply/funds/templates/funds/includes/review_table.html @@ -1,33 +1,47 @@ {% load review_tags %} <table class="reviews-sidebar js-reviews-sidebar"> - {% if staff_reviews or object.staff_not_reviewed %} - {% if staff_reviews %} - <tr class="tr tr--subchild light-grey-bg"> - <th colspan="2"></th> - <th>{{ object.reviews.submitted.recommendation|traffic_light }}</th> - <th>{{ object.reviews.submitted.get_score_display|default_if_none:'-' }}</th> - </tr> - {% include 'funds/includes/review_table_row.html' with reviews=staff_reviews %} - {% endif %} + {% if reviews_exist %} + <tr class="tr tr--subchild light-grey-bg"> + <th colspan="2"></th> + <th>{{ recommendation|traffic_light }}</th> + <th></th> + </tr> + {% endif %} - {% if object.staff_not_reviewed %} - {% include 'funds/includes/review_table_row.html' with reviews=object.staff_not_reviewed missing=True %} - {% endif %} - {% else %} + {% if not assigned_staff %} <tr><td colspan="4" class="reviews-sidebar__no-reviews">No reviews yet</td></tr> {% endif %} + {% for review_data in reviews_block.role_reviewed %} + {% include 'funds/includes/review_table_row.html' with review=review_data.review reviewer=review_data.reviewer role=review_data.role %} + {% endfor %} + + {% for review_data in reviews_block.staff_reviewed %} + {% include 'funds/includes/review_table_row.html' with review=review_data.review reviewer=review_data.reviewer %} + {% endfor %} + + {% for review_data in reviews_block.role_not_reviewed %} + {% include 'funds/includes/review_table_row.html' with reviewer=review_data.reviewer role=review_data.role missing=True %} + {% endfor %} + + {% for review_data in reviews_block.staff_not_reviewed %} + {% include 'funds/includes/review_table_row.html' with reviewer=review_data.reviewer missing=True %} + {% endfor %} + {% if object.stage.has_external_review %} <tr class="tr tr--subchild"><td colspan="4"><hr></td></tr> + {% if reviews_block.external_reviewed or reviews_block.external_not_reviewed %} + + {% for review_data in reviews_block.external_reviewed %} + {% include 'funds/includes/review_table_row.html' with review=review_data.review reviewer=review_data.reviewer %} + {% endfor %} - {% if reviewer_reviews or object.reviewers_not_reviewed %} - {% include 'funds/includes/review_table_row.html' with reviews=reviewer_reviews %} - {% if object.reviewers_not_reviewed %} - {% include 'funds/includes/review_table_row.html' with reviews=object.reviewers_not_reviewed missing=True class="hidden" %} - <tr><td colspan="4"><a class="link link--bold link--underlined js-toggle-reviewers" href="#">All Assigned Advisors</a></td></tr> - {% endif %} - {% else %} - <tr><td colspan="4" class="reviews-sidebar__no-reviews">No assignees or reviews yet</td></tr> + {% for review_data in reviews_block.external_not_reviewed %} + {% include 'funds/includes/review_table_row.html' with reviewer=review_data.reviewer missing=True class="hidden" %} + {% endfor %} + + <tr><td colspan="4"><a class="link link--bold link--underlined js-toggle-reviewers" href="#">All Assigned Advisors</a></td></tr> {% endif %} {% endif %} + </table> diff --git a/opentech/apply/funds/templates/funds/includes/review_table_row.html b/opentech/apply/funds/templates/funds/includes/review_table_row.html index 56fb24d3d7b04046b47cdbcb180ad5314d88e689..8e5190c29c6a6f449602af0b86c1b421b44ba415 100644 --- a/opentech/apply/funds/templates/funds/includes/review_table_row.html +++ b/opentech/apply/funds/templates/funds/includes/review_table_row.html @@ -1,22 +1,33 @@ -{% for review in reviews %} - <tr class="tr--subchild {{ class }} {% if missing %}no-response{% endif %}"> - {% if missing %} - <td class="reviews-sidebar__author" colspan="2"><span>{{ review }}</span></td> - <td>-</td> - <td>-</td> - {% else %} - <td class="reviews-sidebar__author" colspan="2"> - {% if request.user.is_apply_staff or request.user == review.author %} - <a href="{% url 'apply:submissions:reviews:review' submission_pk=review.submission.id pk=review.id %}"> - <span>{{ review.author }}</span> - </a> - <div class="reviews-sidebar__date">{{ review.updated_at|date:"Y-m-d" }}</div> - {% else %} - <span>{{ review.author }}</span> - {% endif %} - </td> - <td>{{ review.get_recommendation_display }}</td> - <td>{{ review.get_score_display }}</td> - {% endif %} - </tr> -{% endfor %} +{% load wagtailimages_tags %} + +<tr class="tr--subchild {{ class }} {% if missing %}no-response{% endif %}"> + {% if missing %} + <td class="reviews-sidebar__author" colspan="2"> + <span> + {{ reviewer }} + {% if role %}{% image role.icon max-12x12 %}{% endif %} + </span> + </td> + <td>-</td> + <td>-</td> + {% else %} + <td class="reviews-sidebar__author" colspan="2"> + {% if request.user.is_apply_staff or request.user == reviewer %} + <a href="{% url 'apply:submissions:reviews:review' submission_pk=review.submission.id pk=review.id %}"> + <span> + {{ reviewer }} + {% if role %}{% image role.icon max-12x12 %}{% endif %} + </span> + </a> + <div class="reviews-sidebar__date">{{ review.updated_at|date:"Y-m-d" }}</div> + {% else %} + <span> + {{ reviewer }} + {% if role %}{% image role.icon max-12x12 %}{% endif %} + </span> + {% endif %} + </td> + <td>{{ review.get_recommendation_display }}</td> + <td>{{ review.get_score_display }}</td> + {% endif %} +</tr> 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 7edcad1832cbf156157176e6ead6b98116ed6392..ba2f54d0b562e7ae0d35414fdbbda299eb7e45d8 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 @@ -2,12 +2,20 @@ <div class="actions-bar"> {# Left #} <div class="actions-bar__inner actions-bar__inner--left"> - <p class="actions-bar__total"><span class="js-total-actions">0</span> Selected</p> - <form action="" class="js-batch-update-status"> - <button class="button button--action button--change-status" type="submit">Change status</button> - </form> + {% if heading %} + <h4 class="heading heading--normal heading--no-margin">{{ heading }}</h4> + {% endif %} - <button data-fancybox data-src="#batch-update-reviewers" class="button button--action button--reviewers js-batch-update-reviewers" type="submit">Reviewers</button> + {% if use_batch_actions %} + <div class="actions-bar__inner actions-bar__inner--batch-actions"> + <p class="actions-bar__total"><span class="js-total-actions">0</span> Selected</p> + <form action="" class="js-batch-update-status"> + <button class="button button--action button--change-status" type="submit">Change status</button> + </form> + + <button data-fancybox data-src="#batch-update-reviewers" class="button button--action button--reviewers js-batch-update-reviewers" type="button">Reviewers</button> + </div> + {% endif %} </div> {# Right #} diff --git a/opentech/apply/funds/templates/funds/rounds.html b/opentech/apply/funds/templates/funds/rounds.html index 3f030e2baf8155a2a9d8809578d55a44517ddc8f..1b474f7fc43d3407d6cee34eac35e9c02ea64fe3 100644 --- a/opentech/apply/funds/templates/funds/rounds.html +++ b/opentech/apply/funds/templates/funds/rounds.html @@ -20,7 +20,7 @@ </div> <div class="wrapper wrapper--large wrapper--inner-space-medium"> - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term %} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_batch_actions=False %} {% render_table table %} </div> diff --git a/opentech/apply/funds/templates/funds/submissions_overview.html b/opentech/apply/funds/templates/funds/submissions_overview.html index 614ca7ea03f4eba90e6eb7ec6fb06adc4d52fe10..1c17a481f86da17d3eef4afe6e85ecf2c2192022 100644 --- a/opentech/apply/funds/templates/funds/submissions_overview.html +++ b/opentech/apply/funds/templates/funds/submissions_overview.html @@ -1,5 +1,6 @@ {% extends "funds/base_submissions_table.html" %} {% load static %} +{% load render_table from django_tables2 %} {% block title %}Submissions{% endblock %} {% block content %} @@ -23,8 +24,9 @@ {% endif %} {% block table %} - <h4 class="heading heading--normal heading--no-margin">All Submissions</h4> - {{ block.super }} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action use_batch_actions=False heading="All Submissions" %} + + {% render_table table %} <div class="all-submissions-table__more"> <a href="{% url 'apply:submissions:list' %}">Show all</a> </div> diff --git a/opentech/apply/review/models.py b/opentech/apply/review/models.py index 199d378837f6c0e95aa43ef01c52fd92f12f4c62..1f20b0e415509ad891d335f8c7ef800209d5f2f3 100644 --- a/opentech/apply/review/models.py +++ b/opentech/apply/review/models.py @@ -9,6 +9,7 @@ from django.utils.translation import ugettext_lazy as _ from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel from wagtail.core.fields import StreamField +from opentech.apply.funds.models import AssignedReviewers from opentech.apply.funds.models.mixins import AccessFormData from opentech.apply.review.options import YES, NO, MAYBE, RECOMMENDATION_CHOICES, OPINION_CHOICES from opentech.apply.stream_forms.models import BaseStreamForm @@ -160,8 +161,6 @@ class Review(ReviewFormFieldsMixin, BaseStreamForm, AccessFormData, models.Model @receiver(post_save, sender=Review) def update_submission_reviewers_list(sender, **kwargs): - from opentech.apply.funds.models import AssignedReviewers - review = kwargs.get('instance') # Make sure the reviewer is in the reviewers list on the submission diff --git a/opentech/apply/review/views.py b/opentech/apply/review/views.py index a31eb90dcd0e9a3dca81e3ae219e8121fd5fc5e3..57ea54fa831c754c2e7c0a57ec4864d41befaa62 100644 --- a/opentech/apply/review/views.py +++ b/opentech/apply/review/views.py @@ -1,3 +1,5 @@ +from collections import defaultdict + from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.http import HttpResponseRedirect @@ -23,11 +25,48 @@ from .options import OPINION_CHOICES, AGREE class ReviewContextMixin: def get_context_data(self, **kwargs): - staff_reviews = self.object.reviews.by_staff().select_related('author') - reviewer_reviews = self.object.reviews.by_reviewers().exclude(id__in=staff_reviews).select_related('author') + assigned = self.object.assigned.order_by('role__order').select_related('reviewer') + reviews = self.object.reviews.all().select_related('author') + + reviews_dict = {} + for review in reviews: + reviews_dict[review.author.pk] = review + + reviews_block = defaultdict(list) + for assigned_reviewer in assigned: + reviewer = assigned_reviewer.reviewer + role = assigned_reviewer.role + review = reviews_dict.get(reviewer.pk, None) + if role: + if review: + key = 'role_reviewed' + else: + key = 'role_not_reviewed' + elif reviewer.is_apply_staff: + if review: + key = 'staff_reviewed' + else: + key = 'staff_not_reviewed' + else: + if review: + key = 'external_reviewed' + else: + key = 'external_not_reviewed' + + reviews_block[key].append({ + 'reviewer': reviewer, + 'review': review, + 'role': role, + }) + + # Calculate the recommendation based on role and staff reviews + recommendation = self.object.reviews.by_staff().recommendation() + return super().get_context_data( - staff_reviews=staff_reviews, - reviewer_reviews=reviewer_reviews, + reviews_block=reviews_block, + recommendation=recommendation, + reviews_exist=reviews.count(), + assigned_staff=assigned.staff().exists(), **kwargs, ) diff --git a/opentech/static_src/src/sass/apply/abstracts/_mixins.scss b/opentech/static_src/src/sass/apply/abstracts/_mixins.scss index ed0308e137cac385d8899c56d96e7b2f0d8f30b4..e1beb948c3a18d620144909ed2d2eba0bf56887f 100644 --- a/opentech/static_src/src/sass/apply/abstracts/_mixins.scss +++ b/opentech/static_src/src/sass/apply/abstracts/_mixins.scss @@ -222,7 +222,7 @@ } } -@mixin checkbox-without-label { +@mixin table-checkbox { input[type='checkbox'] { margin: 0 auto; display: block; diff --git a/opentech/static_src/src/sass/apply/components/_actions-bar.scss b/opentech/static_src/src/sass/apply/components/_actions-bar.scss index e60aea02d6b353dda695cd0b54b49a9ae2330f2f..f2afad48abd5958e7b98c28b81740d1cdfff42d2 100644 --- a/opentech/static_src/src/sass/apply/components/_actions-bar.scss +++ b/opentech/static_src/src/sass/apply/components/_actions-bar.scss @@ -26,6 +26,16 @@ } &--left { + display: flex; + flex-direction: column; + align-items: flex-start; + } + + &--right { + align-items: flex-end; + } + + &--batch-actions { display: none; @include media-query(tablet-landscape) { @@ -33,6 +43,7 @@ opacity: 0; pointer-events: none; transition: opacity $quick-transition; + margin: 20px 0 0; .batch-actions-enabled & { opacity: 1; 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 f7e6b5fe2420ffff8aecb5754eed5e70002a72cf..a241d73f00016bb4445753a9eab09a6a752676ba 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 @@ -24,7 +24,6 @@ &.title { @include media-query($table-breakpoint) { width: 130px; - padding-left: 10px; } @include media-query(desktop) { @@ -39,10 +38,11 @@ } &.selected { - @include checkbox-without-label; + @include table-checkbox; @include media-query($table-breakpoint) { - width: 60px; + width: 50px; + padding-right: 0; } } } @@ -65,8 +65,6 @@ @include media-query($table-breakpoint) { display: flex; align-items: center; - padding-top: 10px; - padding-left: 10px; } @include media-query(desktop) { @@ -151,8 +149,9 @@ // batch action checkboxes &.selected { - @include checkbox-without-label; + @include table-checkbox; display: none; + padding-right: 0; @include media-query($table-breakpoint) { display: table-cell; diff --git a/opentech/static_src/src/sass/apply/components/_button.scss b/opentech/static_src/src/sass/apply/components/_button.scss index 1b35fecaee3e34a6f7c3126a87de812b780706dc..9c2afcc23920c948901e7a58eafd243d1c9a4841 100644 --- a/opentech/static_src/src/sass/apply/components/_button.scss +++ b/opentech/static_src/src/sass/apply/components/_button.scss @@ -215,7 +215,7 @@ @include media-query(tablet-landscape) { background: none; - padding: 0; + padding: 10px; border: 0; align-items: center; justify-content: flex-start; diff --git a/opentech/static_src/src/sass/apply/components/_wrapper.scss b/opentech/static_src/src/sass/apply/components/_wrapper.scss index 1d4ac18c0817957a345fd68d67e2b977ca37f3b0..b80aa2b154d104af6634779ee87cbfa784cadd25 100644 --- a/opentech/static_src/src/sass/apply/components/_wrapper.scss +++ b/opentech/static_src/src/sass/apply/components/_wrapper.scss @@ -267,12 +267,9 @@ } &--table-actions { - margin-bottom: 20px; - @include media-query(tablet-portrait) { display: flex; justify-content: space-between; - } @include media-query(tablet-landscape) { diff --git a/opentech/urls.py b/opentech/urls.py index e6845757630e342d14af0be4b2e95fdb6cd03a13..655579b4a3bba5b72ab2b467833fb82bfbdc880b 100644 --- a/opentech/urls.py +++ b/opentech/urls.py @@ -3,12 +3,14 @@ from django.urls import include, path from django.contrib import admin from django.views.decorators.cache import cache_control from django.views.generic import TemplateView +from django.conf.urls import url from wagtail.utils.urlpatterns import decorate_urlpatterns from wagtail.contrib.sitemaps.views import sitemap from wagtail.admin import urls as wagtailadmin_urls from wagtail.core import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls +from wagtail.images.views.serve import ServeView from opentech.public import urls as public_urls from opentech.apply.users.urls import public_urlpatterns as user_urls @@ -61,6 +63,10 @@ if settings.DEBUG or settings.ENABLE_STYLEGUIDE: path('styleguide/', TemplateView.as_view(template_name='styleguide.html')), ] +urlpatterns += [ + url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$', ServeView.as_view(), name='wagtailimages_serve'), +] + urlpatterns += [ path('', include(wagtail_urls)), ]