WikiLerni/views/wikilerni/quiz-group.pug

112 lines
8.6 KiB
Plaintext

extends layout.pug
block append scripts
script(src="/JS/polyfill.app.js" defer)
script(src="/JS/group.app.js" defer)
block content
// Il n'y a pas d'illustration spécifique au groupe, donc on reprend celle du premier élément du groupe de quizs
-
if(group.Questionnaires.length !==0)
{
const imgAttributes = { alt: txtIllustration.defaultAlt, style: "opacity: 0.0;" };
if(group.Questionnaires[0].Illustrations!=undefined && group.Questionnaires[0].Illustrations.length!==0)
{
if (tool.isEmpty(group.Questionnaires[0].Illustrations[0].alt)===false)
imgAttributes.alt=group.Questionnaires[0].Illustrations[0].alt;
if(tool.isEmpty(group.Questionnaires[0].Illustrations[0].title)===false)
imgAttributes.title=group.Questionnaires[0].Illustrations[0].title;
}
}
const publishedAtTxt=tool.dateFormat(group.Group.publishingAt, group.Group.language);
const updatedAtTxt=tool.dateFormat(group.Group.updatedAt, group.Group.language);
if(group.Questionnaires.length !==0 && group.Questionnaires[0].Illustrations!=undefined && group.Questionnaires[0].Illustrations.length!==0)
div(id="content-picture" class="cardboard")
div(style="background-image: url('/img/quizs/"+group.Questionnaires[0].Illustrations[0].url+"');")
img(src="/img/quizs/"+group.Questionnaires[0].Illustrations[0].url)&attributes(imgAttributes)
//- Important : ici, on garde volontairement le html saisi car lien possible vers auteur de l'illustration :
if(group.Questionnaires[0].Illustrations[0].caption)
p !{group.Questionnaires[0].Illustrations[0].caption}
div(id="content-side")
div(id="content-title")
h1(class="cardboard")
img(id="required-time-icon" src="/themes/wikilerni/img/time-required-medium.png")
span #{group.Group.title}
if(group.Questionnaires.length !==0 && group.Questionnaires[0].Illustrations!=undefined && group.Questionnaires[0].Illustrations.length!==0)
a(href="/img/quizs/"+group.Questionnaires[0].Illustrations[0].url target="_blank" rel="noopener")
img(src="/img/quizs/min/"+group.Questionnaires[0].Illustrations[0].url class="thumb")&attributes(imgAttributes)
div(id="content-title-corner")
div(id="content" class="cardboard")
p(id="author-date") #{txtGroups.publishedBy} #{author} #{txtGroups.publishedAt} #{publishedAtTxt}. #{txtGroups.lastUpdated} #{updatedAtTxt}.
//- Important : ici, on garde volontairement le html, car cela est accepté pour l'introduction.
div#introduction
if(group.Group.introduction)
div !{group.Group.introduction}
// Formulaire du quiz
noscript
div
strong #{configTpl.noJSNotification}
form(id="group" method="POST")
h2 #{group.Group.title}
div#response
div(class="subscribeBtns")
p
a(class="button cardboard" href=configTpl.subscribePage) #{txtGeneral.btnProposeSubscribe}
p
a(class="button cardboard" href=configTpl.connectionPage) #{txtGeneral.btnProposeConnection}
for questionnaire in group.Questionnaires
for question in questionnaire.Questions
p(id="question_"+question.Question.id) #{question.Question.text}
if(question.Question.explanation)
blockquote(class="help" id="help_"+question.Question.id cite=config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaires+"/"+questionnaire.Questionnaire.slug+".html")
span #{txtexplanationBeforeTxt} #{question.Question.explanation+" "}
a(href=config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaires+"/"+questionnaire.Questionnaire.slug+".html") #{configTpl.answersExplanationsLinkText}
ul(class="checkbox_li")
for response in question.Choices
li(class="checkbox_li")
label(class="check" for="response_"+response.id)
input(type="checkbox" name="response_"+response.id id="response_"+response.id)
div(class="checkbox_override")
span(class="wrongResponse")
img(src="/themes/wikilerni/img/wrong-min.png" title=txtGroups.wrongAnswerTxt)
span(class="rightResponse")
img(src="/themes/wikilerni/img/correct-min.png" title=txtGroups.correctAnswerTxt)
em #{response.text}
input(type="hidden" name="isCorrect_response_"+response.id id="isCorrect_response_"+response.id value=""+response.isCorrect)
input(type="hidden" name="question_id_response_"+response.id id="question_id_response_"+response.id value=question.Question.id)
input(name="groupId" id="groupId" value=group.Group.id type="hidden")
// Bouton submit caché si pas de JS, car nécessaire au traitement de la réponse
p
span(class="input_wrapper")
input(id="checkResponses" type="submit" value=txtGroups.btnSendResponse class="cardboard needJS" title=txtGroups.btnSendResponse)
div#licence
p !{configTpl.licenceTxt}
div#zerozozio
a(href="mailto:?to=&subject="+group.Group.title+"&body="+txtQuestionnaire.btnShareQuizMailBody+linkCanonical rel="nofollow noopener" title=txtQuestionnaire.btnShareQuizTxt+"e-mail* ("+txtGeneral.alertNewWindow+")" target="_blank")
img(src="/themes/wikilerni/img/email.png" alt=txtQuestionnaire.btnShareQuizTxt+"mail")
a(href="http://sharetodiaspora.github.io/?url="+linkCanonical+"&title="+group.Group.title rel="nofollow noopener" title=txtQuestionnaire.btnShareQuizTxt+"diaspora* ("+txtGeneral.alertNewWindow+")" target="_blank")
img(src="/themes/wikilerni/img/diaspora.png" alt=txtQuestionnaire.btnShareQuizTxt+"diaspora*")
a(href="https://www.facebook.com/sharer.php?u="+linkCanonical rel="nofollow noopener" title=txtQuestionnaire.btnShareQuizTxt+"facebook ("+txtGeneral.alertNewWindow+")" target="_blank")
img(src="/themes/wikilerni/img/facebook.png" alt=txtQuestionnaire.btnShareQuizTxt+"facebook")
a(href="https://www.linkedin.com/shareArticle?mini=true&url="+linkCanonical+";title="+group.Group.title rel="nofollow noopener" title=txtQuestionnaire.btnShareQuizTxt+"LinkedIn ("+txtGeneral.alertNewWindow+")" target="_blank")
img(src="/themes/wikilerni/img/linkedin.png" alt=txtQuestionnaire.btnShareQuizTxt+"LinkedIn")
a(href="https://twitter.com/intent/tweet?url="+linkCanonical+"&text="+group.Group.title+" via @"+configTpl.twitterAccount rel="nofollow noopener" title=txtQuestionnaire.btnShareQuizTxt+"twitter ("+txtGeneral.alertNewWindow+")" target="_blank")
img(src="/themes/wikilerni/img/twitter.png" alt=txtQuestionnaire.btnShareQuizTxt+"twitter")
div#explanations(class="engraved framed")
h3#explanationsTitle #{configTpl.explanationTitle}
p.info !{txtGroups.commonIntroTxt}
// - lien vers premier élément du groupe (html autorisé pour permettre les symboles unicodes)
div#explanationsContent
if(group.Questionnaires.length !==0)
div#links
a(href="/"+configQuestionnaires.dirWebQuestionnaires+"/"+group.Questionnaires[0].Questionnaire.slug+".html" class="button cardboard" title=group.Questionnaires[0].Questionnaire.title) !{"← "+txtGroups.linkFirstElementGroup}