Commit 9807c176 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Fix indentation in Web_templates

parent 21ce63f9
...@@ -75,7 +75,7 @@ let make_login_box style auth links = ...@@ -75,7 +75,7 @@ let make_login_box style auth links =
) )
let site_login_box = let site_login_box =
let auth = (module Web_site_auth : AUTH_SERVICES) in let auth = (module Web_site_auth : AUTH_SERVICES) in
let module L = struct let module L = struct
let login x = Eliom_service.preapply site_login x let login x = Eliom_service.preapply site_login x
...@@ -84,7 +84,7 @@ let make_login_box style auth links = ...@@ -84,7 +84,7 @@ let make_login_box style auth links =
let links = (module L : AUTH_LINKS) in let links = (module L : AUTH_LINKS) in
fun () -> make_login_box admin_background auth links fun () -> make_login_box admin_background auth links
let base ~title ~login_box ~content ?(footer = div []) () = let base ~title ~login_box ~content ?(footer = div []) () =
Lwt.return (html ~a:[a_dir `Ltr; a_xml_lang "en"] Lwt.return (html ~a:[a_dir `Ltr; a_xml_lang "en"]
(head (Eliom_content.Html5.F.title (pcdata title)) [ (head (Eliom_content.Html5.F.title (pcdata title)) [
script (pcdata "window.onbeforeunload = function () {};"); script (pcdata "window.onbeforeunload = function () {};");
...@@ -115,7 +115,7 @@ let make_login_box style auth links = ...@@ -115,7 +115,7 @@ let make_login_box style auth links =
]] ]]
])) ]))
let format_election kind election = let format_election kind election =
let module W = (val election : WEB_ELECTION) in let module W = (val election : WEB_ELECTION) in
let e = W.election.e_params in let e = W.election.e_params in
let service = let service =
...@@ -130,7 +130,7 @@ let make_login_box style auth links = ...@@ -130,7 +130,7 @@ let make_login_box style auth links =
p [pcdata e.e_description]; p [pcdata e.e_description];
] ]
let home ~featured () = let home ~featured () =
let featured_box = match featured with let featured_box = match featured with
| _::_ -> | _::_ ->
div [ div [
...@@ -151,7 +151,7 @@ let make_login_box style auth links = ...@@ -151,7 +151,7 @@ let make_login_box style auth links =
let login_box = pcdata "" in let login_box = pcdata "" in
base ~title:site_title ~login_box ~content () base ~title:site_title ~login_box ~content ()
let admin ~elections () = let admin ~elections () =
let title = site_title ^ " — Administration" in let title = site_title ^ " — Administration" in
let elections = let elections =
match elections with match elections with
...@@ -169,7 +169,7 @@ let make_login_box style auth links = ...@@ -169,7 +169,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
module Login (S : AUTH_SERVICES) (L : AUTH_LINKS) : LOGIN_TEMPLATES = struct module Login (S : AUTH_SERVICES) (L : AUTH_LINKS) : LOGIN_TEMPLATES = struct
let login_box = let login_box =
let auth = (module S : AUTH_SERVICES) in let auth = (module S : AUTH_SERVICES) in
...@@ -262,18 +262,18 @@ let make_login_box style auth links = ...@@ -262,18 +262,18 @@ let make_login_box style auth links =
lwt login_box = login_box () in lwt login_box = login_box () in
base ~title:"Log in" ~login_box ~content () base ~title:"Log in" ~login_box ~content ()
end end
let format_date = Platform.format_datetime "%a, %d %b %Y %T %z" let format_date = Platform.format_datetime "%a, %d %b %Y %T %z"
let make_button ~service contents = let make_button ~service contents =
let uri = Eliom_uri.make_string_uri ~service () in let uri = Eliom_uri.make_string_uri ~service () in
Printf.ksprintf Unsafe.data (* FIXME: unsafe *) Printf.ksprintf Unsafe.data (* FIXME: unsafe *)
"<button onclick=\"location.href='%s';\" style=\"font-size:35px;\">%s</button>" "<button onclick=\"location.href='%s';\" style=\"font-size:35px;\">%s</button>"
uri uri
contents contents
let new_election () = let new_election () =
let title = "Create new election" in let title = "Create new election" in
lwt body = lwt body =
let form = post_form ~service:new_election_post let form = post_form ~service:new_election_post
...@@ -321,7 +321,7 @@ let make_login_box style auth links = ...@@ -321,7 +321,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let new_election_failure reason () = let new_election_failure reason () =
let title = "Create new election" in let title = "Create new election" in
let reason = let reason =
match reason with match reason with
...@@ -337,7 +337,7 @@ let make_login_box style auth links = ...@@ -337,7 +337,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let election_setup_index uuids () = let election_setup_index uuids () =
let service = election_setup in let service = election_setup in
let title = "Elections being prepared" in let title = "Elections being prepared" in
let uuids = let uuids =
...@@ -356,7 +356,7 @@ let make_login_box style auth links = ...@@ -356,7 +356,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let generic_error_page message () = let generic_error_page message () =
let title = "Error" in let title = "Error" in
let content = [ let content = [
p [pcdata message]; p [pcdata message];
...@@ -364,7 +364,7 @@ let make_login_box style auth links = ...@@ -364,7 +364,7 @@ let make_login_box style auth links =
let login_box = pcdata "" in let login_box = pcdata "" in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let election_setup uuid se () = let election_setup uuid se () =
let title = "Preparation of election " ^ Uuidm.to_string uuid in let title = "Preparation of election " ^ Uuidm.to_string uuid in
let make_form ?a service value title = let make_form ?a service value title =
post_form ?a ~service post_form ?a ~service
...@@ -441,7 +441,7 @@ let make_login_box style auth links = ...@@ -441,7 +441,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let election_setup_questions uuid se () = let election_setup_questions uuid se () =
let title = "Questions for election " ^ Uuidm.to_string uuid in let title = "Questions for election " ^ Uuidm.to_string uuid in
let form = let form =
let value = string_of_template se.se_questions in let value = string_of_template se.se_questions in
...@@ -477,7 +477,7 @@ let make_login_box style auth links = ...@@ -477,7 +477,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let election_setup_credentials token uuid se () = let election_setup_credentials token uuid se () =
let title = "Credentials for election " ^ uuid in let title = "Credentials for election " ^ uuid in
let form_textarea = let form_textarea =
post_form post_form
...@@ -544,7 +544,7 @@ let make_login_box style auth links = ...@@ -544,7 +544,7 @@ let make_login_box style auth links =
let login_box = pcdata "" in let login_box = pcdata "" in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let election_setup_trustee token uuid se () = let election_setup_trustee token uuid se () =
let title = "Trustee for election " ^ uuid in let title = "Trustee for election " ^ uuid in
let form = let form =
let value = !(List.assoc token se.se_public_keys) in let value = !(List.assoc token se.se_public_keys) in
...@@ -591,7 +591,7 @@ let make_login_box style auth links = ...@@ -591,7 +591,7 @@ let make_login_box style auth links =
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let election_login_box w = let election_login_box w =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
let auth = (module W.S : AUTH_SERVICES) in let auth = (module W.S : AUTH_SERVICES) in
let module L = struct let module L = struct
...@@ -607,13 +607,13 @@ let make_login_box style auth links = ...@@ -607,13 +607,13 @@ let make_login_box style auth links =
let links = (module L : AUTH_LINKS) in let links = (module L : AUTH_LINKS) in
fun () -> make_login_box "" auth links fun () -> make_login_box "" auth links
let file w x = let file w x =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
Eliom_service.preapply Eliom_service.preapply
election_dir election_dir
(W.election.e_params.e_uuid, x) (W.election.e_params.e_uuid, x)
let election_home w state () = let election_home w state () =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
lwt user = W.S.get_user () in lwt user = W.S.get_user () in
let params = W.election.e_params and m = W.metadata in let params = W.election.e_params and m = W.metadata in
...@@ -738,7 +738,7 @@ let make_login_box style auth links = ...@@ -738,7 +738,7 @@ let make_login_box style auth links =
lwt login_box = election_login_box w () in lwt login_box = election_login_box w () in
base ~title:params.e_name ~login_box ~content ~footer () base ~title:params.e_name ~login_box ~content ~footer ()
let election_admin w ~is_featured state () = let election_admin w ~is_featured state () =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
let title = W.election.e_params.e_name ^ " — Administration" in let title = W.election.e_params.e_name ^ " — Administration" in
let feature_form = post_form ~service:election_set_featured let feature_form = post_form ~service:election_set_featured
...@@ -776,7 +776,7 @@ let make_login_box style auth links = ...@@ -776,7 +776,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title ~login_box ~content () base ~title ~login_box ~content ()
let update_credential w () = let update_credential w () =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
let params = W.election.e_params in let params = W.election.e_params in
let form = post_form ~service:election_update_credential_post let form = post_form ~service:election_update_credential_post
...@@ -817,7 +817,7 @@ let make_login_box style auth links = ...@@ -817,7 +817,7 @@ let make_login_box style auth links =
lwt login_box = site_login_box () in lwt login_box = site_login_box () in
base ~title:params.e_name ~login_box ~content () base ~title:params.e_name ~login_box ~content ()
let cast_raw w () = let cast_raw w () =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
let params = W.election.e_params in let params = W.election.e_params in
let form_rawballot = post_form ~service:election_cast_post let form_rawballot = post_form ~service:election_cast_post
...@@ -850,7 +850,7 @@ let make_login_box style auth links = ...@@ -850,7 +850,7 @@ let make_login_box style auth links =
lwt login_box = election_login_box w () in lwt login_box = election_login_box w () in
base ~title:params.e_name ~login_box ~content () base ~title:params.e_name ~login_box ~content ()
let cast_confirmation w ~can_vote hash () = let cast_confirmation w ~can_vote hash () =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
lwt user = W.S.get_user () in lwt user = W.S.get_user () in
let params = W.election.e_params in let params = W.election.e_params in
...@@ -912,7 +912,7 @@ let make_login_box style auth links = ...@@ -912,7 +912,7 @@ let make_login_box style auth links =
lwt login_box = election_login_box w () in lwt login_box = election_login_box w () in
base ~title:name ~login_box ~content () base ~title:name ~login_box ~content ()
let cast_confirmed w ~result () = let cast_confirmed w ~result () =
let module W = (val w : WEB_ELECTION_) in let module W = (val w : WEB_ELECTION_) in
let params = W.election.e_params in let params = W.election.e_params in
let name = params.e_name in let name = params.e_name in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment