From 216ca76fc3518d5369b3501822a22cd712dec548 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sat, 5 Feb 2022 15:11:30 +0100 Subject: 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 --- src/pages.ml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/pages.ml') 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 ? --> |} -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 " " (escape group)) + groups + |> String.concat "\n" in + {|
+

Trouver les cours sans salle

+
+ +|} ^ group_fields ^ {| + +
+
+|} + | _ -> "" in common @@ {|

Lien de l'emploi du temps

|} ^ lnk ^ {|
-|} +|} ^ form let select module_id groups = let options = -- cgit v1.2.1