liquid_feedback_frontend

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/survey/_notification.lua	Fri Oct 08 00:09:23 2021 +0200
     1.3 @@ -0,0 +1,61 @@
     1.4 +if not app.session.member then
     1.5 +  return
     1.6 +end
     1.7 +local survey = Survey:get_open()
     1.8 +
     1.9 +if not survey then
    1.10 +  return
    1.11 +end
    1.12 +
    1.13 +local survey_member = SurveyMember:by_pk(survey.id, app.session.member_id)
    1.14 +
    1.15 +if not survey_member or survey_member.answer_set and not survey_member.finished then
    1.16 +  slot.select("motd", function()
    1.17 +    ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    1.18 +      ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    1.19 +        ui.form{
    1.20 +          module = "survey", action = "participate",
    1.21 +          routing = {
    1.22 +            ok = { mode = "redirect", module = "survey", view = "participate" },
    1.23 +            error = { mode = "forward", module = "survey", view = "participate" },
    1.24 +            skip_survey = { mode = "redirect", module = "index", view = "index" },
    1.25 +          },
    1.26 +          content = function()
    1.27 +            ui.heading{ content = survey.title }
    1.28 +            ui.container{ content = function()
    1.29 +              slot.put(survey.text)
    1.30 +            end }
    1.31 +            slot.put("<br>")
    1.32 +            local start_text = _"Start survey"
    1.33 +            local cancel_text = _"I don't want to particiapte"
    1.34 +            if survey_member then
    1.35 +              start_text = _"Continue survey"
    1.36 +              cancel_text = _"Cancel survey"
    1.37 +            end
    1.38 +            ui.tag{
    1.39 +              tag = "input",
    1.40 +              attr = {
    1.41 +                type = "submit",
    1.42 +                class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
    1.43 +                value = start_text
    1.44 +              },
    1.45 +              content = ""
    1.46 +            }
    1.47 +            slot.put(" &nbsp; ")
    1.48 +            ui.tag{
    1.49 +              tag = "input",
    1.50 +              attr = {
    1.51 +                type = "submit",
    1.52 +                name = "skip_survey",
    1.53 +                class = "mdl-button mdl-js-button",
    1.54 +                value = cancel_text
    1.55 +              },
    1.56 +              content = ""
    1.57 +            }
    1.58 +          end
    1.59 +        }
    1.60 +      end }
    1.61 +    end }
    1.62 +  end)
    1.63 +end
    1.64 +

Impressum / About Us