[IMP] survey: improve some survey pages

Survey has several side pages related to corner cases: closed surveys, void
surveys, ... those templates need a bit of polishing. Other main templates
are left untouched and will probably be improved in other tasks.

This commit is linked to task ID 1911586 and PR #28986.
This commit is contained in:
Thibault Delavallée
2019-01-14 15:22:18 +00:00
parent 7c50807bec
commit 1c5371a966
2 changed files with 13 additions and 9 deletions
+3 -3
View File
@@ -117,13 +117,13 @@ class Survey(http.Controller):
answer_sudo = access_data['answer_sudo']
if error_key == 'survey_void' and access_data['can_answer']:
return request.render("survey.nopages", {'survey': survey_sudo})
return request.render("survey.survey_void", {'survey': survey_sudo})
elif error_key == 'survey_closed' and access_data['can_answer']:
return request.render("survey.notopen")
return request.render("survey.survey_expired", {'survey': survey_sudo})
elif error_key == 'survey_auth' and answer_sudo.token:
return request.render("survey.auth_required", {'survey': survey_sudo, 'token': answer_sudo.token})
elif error_key == 'answer_deadline' and answer_sudo.token:
return request.render("survey.notopen")
return request.render("survey.survey_expired", {'survey': survey_sudo})
return werkzeug.utils.redirect("/")
+10 -6
View File
@@ -34,13 +34,13 @@
</template>
<!-- Message when the survey is not open -->
<template id="notopen" name="Survey not open">
<template id="survey_expired" name="Survey Expired">
<t t-call="survey.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron mt32">
<h1>Not open</h1>
<p>This survey is not open. Thank you for your interest!</p>
<h1><span t-field="survey.title"/> survey expired</h1>
<p>This survey is now closed. Thank you for your interest !</p>
</div>
</div>
</div>
@@ -64,14 +64,18 @@
</template>
<!-- Message when the survey has no pages -->
<template id="nopages" name="Survey has no pages">
<template id="survey_void" name="Survey has no pages">
<t t-call="survey.layout">
<div class="wrap">
<div class="container">
<t t-call="survey.back" />
<div class="jumbotron mt32">
<h1>Not ready</h1>
<p>This survey has no pages by now!</p>
<h1><span t-field="survey.title"/> survey is void</h1>
<p>This survey has no question defined currently.<br />
<a t-att-href="'/web#view_type=form&amp;model=survey.survey&amp;id=%s&amp;action=survey.action_survey_form' % survey.id"
class="btn btn-secondary"
groups="survey.group_survey_manager">Edit in backend</a>
</p>
</div>
</div>
</div>