diff options
author | Alban Gruin | 2022-02-05 15:11:30 +0100 |
---|---|---|
committer | Alban Gruin | 2022-02-05 15:17:16 +0100 |
commit | 216ca76fc3518d5369b3501822a22cd712dec548 (patch) | |
tree | b5f9ee5f3e465db259de9429c237b772ecb2a96e /src/pages.ml | |
parent | fd98d82477140a33fca1f7b5057c3c014f75dbbe (diff) |
server: extract the function reading the module id and groups
A new function, listing events with no location, will also need to read
the module id and groups from request parameters. Extract the function
taking care of that to avoid code duplication.
This also adds a button on the link page, to access to the page listing
events without location. This feature is not yet implemented.
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
Diffstat (limited to 'src/pages.ml')
-rw-r--r-- | src/pages.ml | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/pages.ml b/src/pages.ml index e9f255a..6fd7bef 100644 --- a/src/pages.ml +++ b/src/pages.ml @@ -99,14 +99,31 @@ d’Apple), et ainsi attirer plus d’utilisateurs ? --> </section> |} -let link lnk = +let link ?args lnk = let lnk = escape lnk in + let form = match args with + | Some (module_id, groups) -> + let group_fields = + List.map (fun group -> + Printf.sprintf " <input type=\"hidden\" name=\"groups\" value=\"%s\" />" (escape group)) + groups + |> String.concat "\n" in + {| <section> + <h3>Trouver les cours sans salle</h3> + <form method="post" action="/empty"> + <input type="hidden" name="module" value="|} ^ module_id ^ {|" /> +|} ^ group_fields ^ {| + <input type="submit" value="Trouver les cours sans salle" /> + </form> + </section> +|} + | _ -> "" in common @@ {| <section> <h3>Lien de l'emploi du temps</h3> <a href="|} ^ lnk ^ {|">|} ^ lnk ^ {|</a> </section> -|} +|} ^ form let select module_id groups = let options = |