Skip to content

Commit f4dc4f9

Browse files
committed
access session properties form from Right of Reply page
1 parent 40a8cb9 commit f4dc4f9

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

crowdsourcer/templates/crowdsourcer/authority_properties.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
<h1 class="mb-4">Sign in</h1>
88
<a href="{% url 'login' %}">Sign in</a>
99
{% else %}
10+
<p class="mb-4">
11+
<a href="{{ back_link }}">Return to section list</a>
12+
</p>
1013
<h1 class="mb-4">Optional Information</h1>
11-
1214
{% if message %}
1315
<h3 class="mb-4 mb-md-5 text-success">
1416
{{ message }}

crowdsourcer/templates/crowdsourcer/authority_section_list.html

+9
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,14 @@ <h1 class="mb-4">Sections</h1>
4040
{% endfor %}
4141
</tbody>
4242
</table>
43+
44+
{% if has_properties %}
45+
<div class="my-5" style="max-width: 40rem">
46+
<h2 class="mb-3 h4">Help us by providing optional feedback</h2>
47+
<p>Help us improve the Scorecards process next year by answering a few optional questions. Your answers will have no effect on your council’s score.</p>
48+
<a href="{% session_url "authority_properties" authority_name "Right of Reply" %}" class="btn btn-outline-primary">Complete optional questions</a>
49+
</div>
50+
{% endif %}
51+
4352
{% endif %}
4453
{% endblock %}

crowdsourcer/views/marking.py

+23
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,29 @@ def get_form(self):
383383

384384
return form
385385

386+
def get_context_data(self, **kwargs):
387+
context_data = super().get_context_data(**kwargs)
388+
389+
stage = self.kwargs["stage"]
390+
name = self.kwargs["name"]
391+
url_kwargs = {
392+
"marking_session": self.request.current_session.label,
393+
"name": name,
394+
}
395+
396+
back_link = reverse(
397+
"session_urls:home",
398+
kwargs={"marking_session": self.request.current_session},
399+
)
400+
401+
if stage == "Right of Reply":
402+
back_link = reverse(
403+
"session_urls:authority_ror_sections", kwargs=url_kwargs
404+
)
405+
406+
context_data["back_link"] = back_link
407+
return context_data
408+
386409
def form_valid(self, form):
387410
authority = PublicAuthority.objects.get(name=self.kwargs["name"])
388411

crowdsourcer/views/rightofreply.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Response,
1515
ResponseType,
1616
Section,
17+
SessionProperties,
1718
)
1819
from crowdsourcer.views.base import BaseQuestionView
1920

@@ -127,6 +128,9 @@ def get_context_data(self, **kwargs):
127128
section.complete = 0
128129

129130
context["ror_user"] = True
131+
context["has_properties"] = SessionProperties.objects.filter(
132+
marking_session=self.request.current_session, stage=response_type
133+
).exists()
130134
return context
131135

132136

0 commit comments

Comments
 (0)