liquid_feedback_frontend

view app/main/survey/_notification.lua @ 1735:5a8a09119865

Added survey feature
author bsw
date Fri Oct 08 00:09:23 2021 +0200 (2021-10-08)
parents
children
line source
1 if not app.session.member then
2 return
3 end
4 local survey = Survey:get_open()
6 if not survey then
7 return
8 end
10 local survey_member = SurveyMember:by_pk(survey.id, app.session.member_id)
12 if not survey_member or survey_member.answer_set and not survey_member.finished then
13 slot.select("motd", function()
14 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
15 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
16 ui.form{
17 module = "survey", action = "participate",
18 routing = {
19 ok = { mode = "redirect", module = "survey", view = "participate" },
20 error = { mode = "forward", module = "survey", view = "participate" },
21 skip_survey = { mode = "redirect", module = "index", view = "index" },
22 },
23 content = function()
24 ui.heading{ content = survey.title }
25 ui.container{ content = function()
26 slot.put(survey.text)
27 end }
28 slot.put("<br>")
29 local start_text = _"Start survey"
30 local cancel_text = _"I don't want to particiapte"
31 if survey_member then
32 start_text = _"Continue survey"
33 cancel_text = _"Cancel survey"
34 end
35 ui.tag{
36 tag = "input",
37 attr = {
38 type = "submit",
39 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
40 value = start_text
41 },
42 content = ""
43 }
44 slot.put(" &nbsp; ")
45 ui.tag{
46 tag = "input",
47 attr = {
48 type = "submit",
49 name = "skip_survey",
50 class = "mdl-button mdl-js-button",
51 value = cancel_text
52 },
53 content = ""
54 }
55 end
56 }
57 end }
58 end }
59 end)
60 end

Impressum / About Us