layouts: add inscription form to activites

This commit is contained in:
Diego Joss
2025-06-09 23:43:20 +02:00
parent d0c834bbf2
commit a40b6d9f86
2 changed files with 151 additions and 2 deletions

View File

@ -10,8 +10,8 @@ enableRobotsTXT = true
pagerSize = 3 # this is set low for demonstrating with dummy content. Set to a higher number
[params]
mainSections = ["news", "activite"]
recent_posts_number = 3
mainSections = ["activite", "news"]
recent_posts_number = 10
[params.ananke]
show_recent_posts = true

View File

@ -0,0 +1,149 @@
{{ define "header" }}
{{/* We can override any block in the baseof file be defining it in the template */}}
{{ partial "page-header.html" . }}
{{ end }}
{{ define "main" }}
{{ $page := .}}
{{ $section := .Site.GetPage "section" .Section }}
<article class="flex-l flex-wrap justify-between mw8 center ph3">
<header class="mt4 w-100">
<aside class="instapaper_ignoref b helvetica tracked ttu">
{{/*
CurrentSection allows us to use the section title instead of inferring from the folder.
https://gohugo.io/variables/page/#section-variables-and-methods
*/}}
{{ .CurrentSection.Title }}
</aside>
{{- partialCached "social/share.html" . . -}}
<h1 class="f1 athelas mt3 mb1">
{{- .Title -}}
</h1>
{{ with .Params.author | default .Site.Params.author }}
<p class="tracked">
{{- if eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}}
{{- i18n "by" -}}
{{ end -}} <strong>
{{- if reflect.IsSlice . -}}
{{ delimit . ", " | markdownify }}
{{- else -}}
{{ . | markdownify }}
{{- end -}}
</strong>
</p>
{{ end }}
{{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
{{ if not .Date.IsZero }}
<time class="f6 mv4 dib tracked" {{ printf `datetime="%s"` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}>
{{- .Date | time.Format (default "January 2, 2006" .Site.Params.date_format) -}}
</time>
{{end}}
{{/*
Show "reading time" and "word count" but only if one of the following are true:
1) A global config `params` value is set `show_reading_time = true`
2) A section front matter value is set `show_reading_time = true`
3) A page front matter value is set `show_reading_time = true`
*/}}
{{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}}
<span class="f6 mv4 dib tracked"> - {{ i18n "readingTime" .ReadingTime }} </span>
<span class="f6 mv4 dib tracked"> - {{ i18n "wordCount" .WordCount }} </span>
{{ end }}
</header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f4 nested-links {{ $.Param "text_color" | default "mid-gray" }} {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl4-l" "pr4-l" }} w-two-thirds-l">
{{- .Content -}}
{{- if eq .Section "activite" }}
<hr/>
<form>
<h2>Formulaire d'inscription</h2>
<h3>Participants</h3>
<p>
<table>
<tr><td>Prénom</td><td>Nom</td><td>Sport</td><td>Date de naissance<br/>(aaaa-mm-jj)</td><td>Numéro AVS</td><td>Ski avec parents</td><td>Magic Pass</tr>
<tr>
<td><input required type="text" name="personne[1][prenom]" size=8 maxlength=20 /></td>
<td><input required type="text" name="personne[1][nom]" size=8 maxlength=20 /></td>
<td><select name="personne[1][sport]"><option value="Aucun">Aucun</option><option value="Ski">Ski</option><option value="Snowboard">Snowboard</option><option value="Raquettes">Raquettes</option></select></td>
<td><input required type="date" name="personne[1][naissance]" size=8 maxlength=10 /></td>
<td><input type="text" name="personne[1][avs]" size=12 maxlength=16 /></td>
<td><input type="checkbox" name="personne[1][avecparents]" value="1" /></td>
<td><input type="checkbox" name="personne[1][magicpass]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="personne[2][prenom]" size=8 maxlength=20 /></td>
<td><input type="text" name="personne[2][nom]" size=8 maxlength=20 /></td>
<td><select name="personne[2][sport]"><option value="Aucun">Aucun</option><option value="Ski">Ski</option><option value="Snowboard">Snowboard</option><option value="Raquettes">Raquettes</option></select></td>
<td><input type="date" name="personne[2][naissance]" size=8 maxlength=10 /></td>
<td><input type="text" name="personne[2][avs]" size=12 maxlength=16 /></td>
<td><input type="checkbox" name="personne[2][avecparents]" value="1" /></td>
<td><input type="checkbox" name="personne[2][magicpass]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="personne[3][prenom]" size=8 maxlength=20 /></td>
<td><input type="text" name="personne[3][nom]" size=8 maxlength=20 /></td>
<td><select name="personne[3][sport]"><option value="Aucun">Aucun</option><option value="Ski">Ski</option><option value="Snowboard">Snowboard</option><option value="Raquettes">Raquettes</option></select></td>
<td><input type="date" name="personne[3][naissance]" size=8 maxlength=10 /></td>
<td><input type="text" name="personne[3][avs]" size=12 maxlength=16 /></td>
<td><input type="checkbox" name="personne[3][avecparents]" value="1" /></td>
<td><input type="checkbox" name="personne[3][magicpass]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="personne[4][prenom]" size=8 maxlength=20 /></td>
<td><input type="text" name="personne[4][nom]" size=8 maxlength=20 /></td>
<td><select name="personne[4][sport]"><option value="Aucun">Aucun</option><option value="Ski">Ski</option><option value="Snowboard">Snowboard</option><option value="Raquettes">Raquettes</option></select></td>
<td><input type="date" name="personne[4][naissance]" size=8 maxlength=10 /></td>
<td><input type="text" name="personne[4][avs]" size=12 maxlength=16 /></td>
<td><input type="checkbox" name="personne[4][avecparents]" value="1" /></td>
<td><input type="checkbox" name="personne[4][magicpass]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="personne[5][prenom]" size=8 maxlength=20 /></td>
<td><input type="text" name="personne[5][nom]" size=8 maxlength=20 /></td>
<td><select name="personne[5][sport]"><option value="Aucun">Aucun</option><option value="Ski">Ski</option><option value="Snowboard">Snowboard</option><option value="Raquettes">Raquettes</option></select></td>
<td><input type="date" name="personne[5][naissance]" size=8 maxlength=10 /></td>
<td><input type="text" name="personne[5][avs]" size=12 maxlength=16 /></td>
<td><input type="checkbox" name="personne[5][avecparents]" value="1" /></td>
<td><input type="checkbox" name="personne[5][magicpass]" value="1" /></td>
</tr>
</table>
</p>
<h3>Vos Coordonnées</h3>
<p>
<table>
<tr>
<td>E-mail:</td><td><input type="email" name="email" required /></td>
</tr>
<tr>
<td>Téléphone:</td><td><input type="tel" name="telephone" required /></td>
</tr>
</table>
</p>
<h3>Commentaire</h3>
<p>
<textarea name="commentaire" maxlength=1024 ></textarea>
</p>
<p>
<input type="submit" value="Envoyer" />
</p>
</form>
{{- end -}}
{{- partial "tags.html" . -}}
<div class="mt6 instapaper_ignoref">
{{ if .Site.Config.Services.Disqus.Shortname }}
{{ template "_internal/disqus.html" . }}
{{ end }}
{{ if .Site.Params.commentoEnable }}
{{- partial "commento.html" . -}}
{{ end }}
</div>
</div>
<aside class="w-30-l mt6-l">
{{- partial "menu-contextual.html" . -}}
</aside>
</article>
{{ end }}