Commit 90afa5e6 authored by Stephane Glondu's avatar Stephane Glondu

Disable "Start" button when the election is not open

parent 2c8bb82a
...@@ -259,11 +259,11 @@ let admin ~elections () = ...@@ -259,11 +259,11 @@ let admin ~elections () =
let%lwt login_box = site_login_box () in let%lwt login_box = site_login_box () in
base ~title ?login_box ~content () base ~title ?login_box ~content ()
let make_button ~service contents = let make_button ~service ~disabled 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>%s</button>"
uri uri (if disabled then " disabled" else "")
contents contents
let a_mailto ~dest ~subject ~body contents = let a_mailto ~dest ~subject ~body contents =
...@@ -1155,11 +1155,15 @@ let election_home w state () = ...@@ -1155,11 +1155,15 @@ let election_home w state () =
in in
let%lwt footer = audit_footer w in let%lwt footer = audit_footer w in
let go_to_the_booth = let go_to_the_booth =
let disabled = match state with
| `Open -> false
| _ -> true
in
div ~a:[a_style "text-align:center;"] [ div ~a:[a_style "text-align:center;"] [
div [ div [
make_button make_button
~service:(Eliom_service.preapply election_vote (params.e_uuid, ())) ~service:(Eliom_service.preapply election_vote (params.e_uuid, ()))
L.start; ~disabled L.start;
]; ];
div [ div [
pcdata L.or_; pcdata L.or_;
......
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