Skip to content

Commit

Permalink
Support feedback page after answering a risk
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Feb 24, 2025
1 parent e9fb146 commit 67f4e58
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Changelog
- Updated resources from proto and applied a number of markup fixes in a review session with Daniel
[pilz]

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


16.2.7 (2025-01-15)
-------------------
Expand Down
7 changes: 7 additions & 0 deletions src/euphorie/client/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,13 @@
permission="euphorie.client.ViewSurvey"
layer="euphorie.client.interfaces.IClientSkinLayer"
/>
<browser:page
name="identification_feedback"
for="euphorie.client.model.Risk"
class=".risk.IdentificationFeedbackView"
permission="euphorie.client.ViewSurvey"
layer="euphorie.client.interfaces.IClientSkinLayer"
/>

<browser:page
name="actionplan"
Expand Down
13 changes: 13 additions & 0 deletions src/euphorie/client/browser/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,11 @@ def proceed_to_next(self, reply):
session_url=self.webhelpers.traversed_session.absolute_url()
)
return self.request.response.redirect(url)

elif _next == "next" and getattr(self.risk, "feedback_text", None):
url = self.context.absolute_url() + "/@@identification_feedback"
return self.request.response.redirect(url)

elif _next in ("next", "skip"):
target = self.next_question
if target is None:
Expand Down Expand Up @@ -1119,6 +1124,14 @@ def calculatePriority(self, risk, reply):
return self.context.priority


class IdentificationFeedbackView(IdentificationView):
default_template = ViewPageTemplateFile("templates/risk_identification_feedback.pt")

def post(self):
reply = self.request.form
return self.proceed_to_next(reply)


class ImageUpload(BrowserView):
def redirect(self):
return self.request.response.redirect(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:meta="http://xml.zope.org/namespaces/meta"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
meta:interpolation="true"
metal:use-macro="context/@@shell/macros/shell"
tal:define="
client nocall:request/client;
webhelpers nocall:context/@@webhelpers;
"
i18n:domain="euphorie"
>

<body>
<metal:slot fill-slot="content"
tal:define="
risk nocall:view/risk;
"
>
<tal:block replace="tile:statusmessages" />
<form class="pat-form pat-inject panel-style"
accept-charset="UTF-8"
action="${here/absolute_url}/@@${view/__name__}"
enctype="multipart/form-data"
method="post"
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"
>
<a class="pat-scroll pat-scroll-animated"
hidden
href="#content-pane"
data-pat-scroll="selector: #content-pane; trigger: auto; offset: 0"
>Scroll to top</a>

<div class="pat-scroll-box"
id="content-pane"
>
<article class="rich"
tal:content="structure:risk/feedback_text|nothing"
></article>
</div>

<p class="button-bar pat-bumper"
id="nav-bar"
>
<button class="pat-button continue"
name="next"
type="submit"
value="skip"
i18n:translate="label_continue"
>Continue</button>
</p>
</form>
</metal:slot>
</body>
</html>
6 changes: 6 additions & 0 deletions src/euphorie/content/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ class IRisk(model.Schema, IRichDescription, IBasic):
default="low",
)

feedback_text = HtmlText(
title=_("label_feedback_text", default="Feedback after answer"),
required=False,
)
directives.widget(feedback_text="plone.app.z3cform.wysiwyg.WysiwygFieldWidget")

model.fieldset(
"main_image",
label=_("header_main_image", default="Main image"),
Expand Down

0 comments on commit 67f4e58

Please sign in to comment.