bsw@1735: if not app.session.member then bsw@1735: return bsw@1735: end bsw@1735: local survey = Survey:get_open() bsw@1735: bsw@1735: if not survey then bsw@1735: return bsw@1735: end bsw@1735: bsw@1735: local survey_member = SurveyMember:by_pk(survey.id, app.session.member_id) bsw@1735: bsw@1735: if not survey_member or survey_member.answer_set and not survey_member.finished then bsw@1735: slot.select("motd", function() bsw@1735: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1735: ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() bsw@1735: ui.form{ bsw@1735: module = "survey", action = "participate", bsw@1735: routing = { bsw@1735: ok = { mode = "redirect", module = "survey", view = "participate" }, bsw@1735: error = { mode = "forward", module = "survey", view = "participate" }, bsw@1735: skip_survey = { mode = "redirect", module = "index", view = "index" }, bsw@1735: }, bsw@1735: content = function() bsw@1735: ui.heading{ content = survey.title } bsw@1735: ui.container{ content = function() bsw@1735: slot.put(survey.text) bsw@1735: end } bsw@1735: slot.put("
") bsw@1735: local start_text = _"Start survey" bsw@1735: local cancel_text = _"I don't want to particiapte" bsw@1735: if survey_member then bsw@1735: start_text = _"Continue survey" bsw@1735: cancel_text = _"Cancel survey" bsw@1735: end bsw@1735: ui.tag{ bsw@1735: tag = "input", bsw@1735: attr = { bsw@1735: type = "submit", bsw@1735: class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored", bsw@1735: value = start_text bsw@1735: }, bsw@1735: content = "" bsw@1735: } bsw@1735: slot.put("   ") bsw@1735: ui.tag{ bsw@1735: tag = "input", bsw@1735: attr = { bsw@1735: type = "submit", bsw@1735: name = "skip_survey", bsw@1735: class = "mdl-button mdl-js-button", bsw@1735: value = cancel_text bsw@1735: }, bsw@1735: content = "" bsw@1735: } bsw@1735: end bsw@1735: } bsw@1735: end } bsw@1735: end } bsw@1735: end) bsw@1735: end bsw@1735: