Skip to content

Commit 23577d2

Browse files
committed
Support feedback page after answering a risk
Ref syslabcom/scrum#2857
1 parent e9fb146 commit 23577d2

File tree

5 files changed

+84
-0
lines changed

5 files changed

+84
-0
lines changed

docs/changes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Changelog
3838
- Updated resources from proto and applied a number of markup fixes in a review session with Daniel
3939
[pilz]
4040

41+
- Support feedback page after answering a risk
42+
(`#2857 <https://github.com/syslabcom/scrum/issues/2857>`_)
43+
[reinhardt]
44+
4145

4246
16.2.7 (2025-01-15)
4347
-------------------

src/euphorie/client/browser/configure.zcml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,13 @@
683683
permission="euphorie.client.ViewSurvey"
684684
layer="euphorie.client.interfaces.IClientSkinLayer"
685685
/>
686+
<browser:page
687+
name="identification_feedback"
688+
for="euphorie.client.model.Risk"
689+
class=".risk.IdentificationFeedbackView"
690+
permission="euphorie.client.ViewSurvey"
691+
layer="euphorie.client.interfaces.IClientSkinLayer"
692+
/>
686693

687694
<browser:page
688695
name="actionplan"

src/euphorie/client/browser/risk.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,11 @@ def proceed_to_next(self, reply):
10091009
session_url=self.webhelpers.traversed_session.absolute_url()
10101010
)
10111011
return self.request.response.redirect(url)
1012+
1013+
elif _next == "next" and getattr(self.risk, "feedback_text", None):
1014+
url = self.context.absolute_url() + "/@@identification_feedback"
1015+
return self.request.response.redirect(url)
1016+
10121017
elif _next in ("next", "skip"):
10131018
target = self.next_question
10141019
if target is None:
@@ -1119,6 +1124,13 @@ def calculatePriority(self, risk, reply):
11191124
return self.context.priority
11201125

11211126

1127+
class IdentificationFeedbackView(IdentificationView):
1128+
default_template = ViewPageTemplateFile("templates/risk_identification_feedback.pt")
1129+
def post(self):
1130+
reply = self.request.form
1131+
return self.proceed_to_next(reply)
1132+
1133+
11221134
class ImageUpload(BrowserView):
11231135
def redirect(self):
11241136
return self.request.response.redirect(
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml"
3+
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
4+
xmlns:meta="http://xml.zope.org/namespaces/meta"
5+
xmlns:metal="http://xml.zope.org/namespaces/metal"
6+
xmlns:tal="http://xml.zope.org/namespaces/tal"
7+
meta:interpolation="true"
8+
metal:use-macro="context/@@shell/macros/shell"
9+
tal:define="
10+
client nocall:request/client;
11+
webhelpers nocall:context/@@webhelpers;
12+
"
13+
i18n:domain="euphorie"
14+
>
15+
16+
<body>
17+
<metal:slot fill-slot="content"
18+
tal:define="
19+
risk nocall:view/risk;
20+
"
21+
>
22+
<tal:block replace="tile:statusmessages" />
23+
<form class="pat-form pat-inject panel-style"
24+
accept-charset="UTF-8"
25+
action="${here/absolute_url}/@@${view/__name__}"
26+
enctype="multipart/form-data"
27+
method="post"
28+
data-pat-inject="history: record; source: #step-2-topics; target: #step-2-topics &amp;&amp; source: #main-content; target: #main-content &amp;&amp; source: #toolbar; target: #toolbar &amp;&amp; source: #status; target: #status"
29+
>
30+
<a class="pat-scroll pat-scroll-animated"
31+
hidden
32+
href="#content-pane"
33+
data-pat-scroll="selector: #content-pane; trigger: auto; offset: 0"
34+
>Scroll to top</a>
35+
36+
<div class="pat-scroll-box"
37+
id="content-pane"
38+
>
39+
<article tal:content="structure:risk/feedback_text|nothing"></article>
40+
</div>
41+
42+
<p class="button-bar pat-bumper"
43+
id="nav-bar"
44+
>
45+
<button class="pat-button continue"
46+
name="next"
47+
type="submit"
48+
value="skip"
49+
i18n:translate="label_continue"
50+
>Continue</button>
51+
</p>
52+
</form>
53+
</metal:slot>
54+
</body>
55+
</html>

src/euphorie/content/risk.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ class IRisk(model.Schema, IRichDescription, IBasic):
236236
default="low",
237237
)
238238

239+
feedback_text = HtmlText(
240+
title=_("label_feedback_text", default="Feedback after answer"),
241+
required=False,
242+
)
243+
directives.widget(feedback_text="plone.app.z3cform.wysiwyg.WysiwygFieldWidget")
244+
239245
model.fieldset(
240246
"main_image",
241247
label=_("header_main_image", default="Main image"),

0 commit comments

Comments
 (0)