From 56c64da5f202a1371926ede557a0cad6d3a7785b Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson <frjo@xdeb.org> Date: Fri, 2 Nov 2018 13:55:53 +0100 Subject: [PATCH] Link the fund/lab on a submission detail viewto the public fund/lab page. --- .../funds/applicationsubmission_detail.html | 4 ++-- opentech/apply/funds/views.py | 15 +++++++++++++++ .../src/sass/apply/components/_link.scss | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_detail.html b/opentech/apply/funds/templates/funds/applicationsubmission_detail.html index eee90dd67..4f11172e9 100644 --- a/opentech/apply/funds/templates/funds/applicationsubmission_detail.html +++ b/opentech/apply/funds/templates/funds/applicationsubmission_detail.html @@ -1,5 +1,5 @@ {% extends "base-apply.html" %} -{% load static workflow_tags %} +{% load static workflow_tags wagtailcore_tags %} {% block title %}{{ object.title }}{% endblock %} {% block body_class %}{% endblock %} {% block content %} @@ -13,7 +13,7 @@ <h1 class="beta heading heading--no-margin heading--bold">{{ object.title }}</h1> <h5 class="heading heading--meta"> <span>{{ object.stage }}</span> - <span>{{ object.page }}</span> + <span>{% if public_page %}<a class="link--transparent link--underlined" href="{% pageurl public_page %}" >{{ object.page }}</a>{% else %}{{ object.page }}{% endif %}</span> <span>{{ object.round }}</span> <span>Lead: {{ object.lead }}</span> </h5> diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py index c72ceb10a..d9161660f 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -25,6 +25,7 @@ from opentech.apply.determinations.views import DeterminationCreateOrUpdateView from opentech.apply.review.views import ReviewContextMixin from opentech.apply.users.decorators import staff_required from opentech.apply.utils.views import DelegateableView, ViewDispatcher +from opentech.public.funds.models import BaseApplicationPage, LabPage from .differ import compare from .forms import ProgressSubmissionForm, UpdateReviewersForm, UpdateSubmissionLeadForm @@ -148,13 +149,27 @@ class AdminSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, Delega redirect = SubmissionSealedView.should_redirect(request, submission) return redirect or super().dispatch(request, *args, **kwargs) + def get_public_page(self, page_id): + try: + return BaseApplicationPage.objects.get(application_type_id=page_id) + except BaseApplicationPage.DoesNotExist: + pass + try: + return LabPage.objects.get(lab_type_id=page_id) + except LabPage.DoesNotExist: + pass + return False + def get_context_data(self, **kwargs): other_submissions = self.model.objects.filter(user=self.object.user).current().exclude(id=self.object.id) if self.object.next: other_submissions = other_submissions.exclude(id=self.object.next.id) + public_page = self.get_public_page(self.object.page.id) + return super().get_context_data( other_submissions=other_submissions, + public_page=public_page, **kwargs, ) diff --git a/opentech/static_src/src/sass/apply/components/_link.scss b/opentech/static_src/src/sass/apply/components/_link.scss index 0926493a3..bb2bb45d7 100644 --- a/opentech/static_src/src/sass/apply/components/_link.scss +++ b/opentech/static_src/src/sass/apply/components/_link.scss @@ -12,6 +12,10 @@ text-decoration: underline; } + &--transparent { + color: $color--white; + } + &--bold { font-weight: $weight--bold; } -- GitLab