Skip to content
Snippets Groups Projects
Commit 2c59c8f0 authored by Eliott Sammier's avatar Eliott Sammier
Browse files

quizzes are now inserted with a shortcode

parent 05b90e0d
Branches
No related tags found
No related merge requests found
File moved
......@@ -22,3 +22,4 @@ title = "L'auxiliaire MUST (1)"
</table>
<p align=\"\">Dans ces énoncés, l'auxiliaire MUST est-il prononcé de façon identique ?<br></p></div>
{{% quiz %}}
\ No newline at end of file
......@@ -6,3 +6,5 @@ title = "Repérer les syllabes orales"
En cliquant sur la flèche, combien de [syllabes]() entendez-vous pour chacun des 3 mots ci-dessous ?
Pour chaque mot, écouter et sélectionnez 1, 2, 3, 4 ou 5 selon le nombre de syllabes entendues.
{{% quiz %}}
\ No newline at end of file
{{ define "css" }}
{{/* Included by the theme in the <head> tag */}}
{{ define "css" }}
{{/* Get CSS as resource and minify */}}
{{- $css := resources.Get "style.css" | resources.Minify }}
<link rel="stylesheet" href="{{- $css.RelPermalink -}}">
{{ with .Resources.GetMatch "survey.json" }}
{{/* if a quiz.json exists in the page resources, load SurveyJS */}}
{{ with .Resources.GetMatch "quiz.json" }}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://unpkg.com/survey-jquery/defaultV2.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="/survey.jquery.min.js"></script>
<script type="text/javascript" src="/index.js"></script>
{{- $quizjs := resources.Get "quiz.js" -}}
<script type="text/javascript" src="{{- $quizjs.RelPermalink -}}"> </script>
{{ end }}
{{ end }}
{{- /* Shortcode that looks for a "quiz.json" resource in the page bundle,
and inserts a SurveyJS quiz using this JSON */ -}}
{{ with $.Page.Resources.GetMatch "quiz.json" }}
<div id="surveyContainer"></div>
<p id="correct-indic"></p>
<script type="text/javascript">
const jsonStatic = {{ .Content | safeJS }};
</script>
{{ end }}
\ No newline at end of file
......@@ -175,16 +175,6 @@ a.post-tag:hover { text-decoration: none; }
}
/******** Survey stuff **************/
#correct-indic {
color: var(--sd-rating-bad-color);
font-weight: bold;
}
#correct-indic.correct {
color: var(--sd-rating-good-color);
}
/******************************************************************************/
/* light mode colors */
/******************************************************************************/
......
......@@ -40,12 +40,7 @@
<title>{{- $pageTitle -}}</title>
<link rel="canonical" href="{{- .Permalink -}}">
{{ with .Resources.GetMatch "survey.json" }}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://unpkg.com/survey-jquery/defaultV2.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="/survey.jquery.min.js"></script>
<script type="text/javascript" src="/index.js"></script>
{{ end }}
{{- $favicon := resources.Get "favicon.png" }}
{{- with $favicon }}
......
......@@ -75,13 +75,6 @@
{{- end }}
{{- $p.Content }}
</div>
{{ with $p.Resources.GetMatch "survey.json" }}
<div id="surveyContainer"></div>
<p id="correct-indic"></p>
<script type="text/javascript">
const jsonStatic = {{ .Content | safeJS }};
</script>
{{ end }}
{{- end }}
{{- if and (ne $t "list") $p.Lastmod (ne $p.Lastmod $p.Date) }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment