Skip to content

Commit

Permalink
access session properties form from Right of Reply page
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Oct 7, 2024
1 parent d517779 commit e02a8d5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crowdsourcer/templates/crowdsourcer/authority_properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ <h1 class="mb-4">Sign in</h1>
{% else %}
<h1 class="mb-4">Optional Information</h1>

<p>
<a href="{{ back_link }}">Return to section list</a>
</p>
{% if message %}
<h3 class="mb-4 mb-md-5 text-success">
{{ message }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ <h1 class="mb-4">Sign in</h1>
<a href="{% url 'login' %}">Sign in</a>
{% else %}
<h1 class="mb-4">Sections</h1>
{% if has_properties %}
<h4>
<a href="{% session_url "authority_properties" authority_name "Right of Reply" %}">Optional feedback</a>
</h4>
{% endif %}
<table class="table">
<thead>
<tr>
Expand Down
23 changes: 23 additions & 0 deletions crowdsourcer/views/marking.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,29 @@ def get_form(self):

return form

def get_context_data(self, **kwargs):
context_data = super().get_context_data(**kwargs)

stage = self.kwargs["stage"]
name = self.kwargs["name"]
url_kwargs = {
"marking_session": self.request.current_session.label,
"name": name,
}

back_link = reverse(
"session_urls:home",
kwargs={"marking_session": self.request.current_session},
)

if stage == "Right of Reply":
back_link = reverse(
"session_urls:authority_ror_sections", kwargs=url_kwargs
)

context_data["back_link"] = back_link
return context_data

def form_valid(self, form):
authority = PublicAuthority.objects.get(name=self.kwargs["name"])

Expand Down
4 changes: 4 additions & 0 deletions crowdsourcer/views/rightofreply.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Response,
ResponseType,
Section,
SessionProperties,
)
from crowdsourcer.views.base import BaseQuestionView

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

context["ror_user"] = True
context["has_properties"] = SessionProperties.objects.filter(
marking_session=self.request.current_session, stage=response_type
).exists()
return context


Expand Down

0 comments on commit e02a8d5

Please sign in to comment.