Show links to individual results on completion

This commit is contained in:
TEC 2022-05-21 00:25:33 +08:00
parent acbc3f70c6
commit 91ee73d71c
Signed by: tec
GPG Key ID: 779591AFDB81F06C
2 changed files with 14 additions and 2 deletions

View File

@ -41,8 +41,15 @@ function new()
end
function completed(uid)
uidstr = string(uid, base=UID_ENCBASE)
links = map(["txt", "org", "json"]) do fmt
(fmt, linkto(:result,
survey = string(SURVEY.id, base=10),
responsefile = string(uidstr, '.', fmt),
preserve_query = false))
end
res = html(:surveys, :thanks, layout=:base;
uid=string(uid, base=UID_ENCBASE), survey=SURVEY)
uid=uidstr, survey=SURVEY, resultlinks=links)
Genie.Cookies.set!(res, "response-id", "", Dict{String, Any}("maxage" => -1))
Genie.Cookies.set!(res, "response-page", 0, Dict{String, Any}("maxage" => -1))
end

View File

@ -11,6 +11,11 @@
<main>
<h2 style="color: var(--primary)"><em>Thank you</em> for taking part in the survey!</h2>
<h5>We hope to see you next year 🙂</h5>
<br /><br />
<p>You can view your results as
<% map(resultlinks) do (fmt, url) %>
<a href="$(url)">$(fmt)</a>
<% end |> l -> join(l, ", ", ", or ")%>
.</p>
<br />
<a href="/" role="button">Go Home</a>
</main>