Commit 9b9d6d6e authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Add progress steps

parent 524bb46c
...@@ -117,6 +117,12 @@ let encryptBallot params cred plaintext () = ...@@ -117,6 +117,12 @@ let encryptBallot params cred plaintext () =
Dom_html.window##onbeforeunload <- Dom_html.no_handler; Dom_html.window##onbeforeunload <- Dom_html.no_handler;
Lwt.return () Lwt.return ()
let progress_step n =
let old_ = Printf.sprintf "progress%d" (n-1) in
let new_ = Printf.sprintf "progress%d" n in
withElementById old_ (fun e -> e##setAttribute (Js.string "style", Js.string ""));
withElementById new_ (fun e -> e##setAttribute (Js.string "style", Js.string "font-weight: bold;"))
let rec createQuestionNode sk params question_div num_questions i prev (q, answers) next = let rec createQuestionNode sk params question_div num_questions i prev (q, answers) next =
(* Create div element for the current question. [i] and [(q, (* Create div element for the current question. [i] and [(q,
answers)] point to the current question. [List.rev prev @ [q, answers)] point to the current question. [List.rev prev @ [q,
...@@ -230,6 +236,7 @@ let rec createQuestionNode sk params question_div num_questions i prev (q, answe ...@@ -230,6 +236,7 @@ let rec createQuestionNode sk params question_div num_questions i prev (q, answe
); );
Lwt_js_events.async (encryptBallot params sk all_answers); Lwt_js_events.async (encryptBallot params sk all_answers);
setDisplayById "plaintext_div" "block"; setDisplayById "plaintext_div" "block";
progress_step 3;
Js._false Js._false
) else Js._false ) else Js._false
); );
...@@ -280,6 +287,7 @@ let createStartButton params intro_div qs = ...@@ -280,6 +287,7 @@ let createStartButton params intro_div qs =
Dom_html.window##onbeforeunload <- Dom_html.handler (fun _ -> Dom_html.window##onbeforeunload <- Dom_html.handler (fun _ ->
Js._false Js._false
); );
progress_step 2;
addQuestions cred params qs addQuestions cred params qs
| None -> () | None -> ()
); );
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
</div> </div>
</div> </div>
<div id="main"> <div id="main">
<div style="text-align:center; margin-bottom:20px;">
<span id="progress1" style="font-weight:bold;">Introduction</span><span id="progress2">Answer to questions</span><span id="progress3">Review and encrypt</span><span id="progress4">Authenticate</span><span id="progress5">Confirm</span><span id="progress6">Done</span>
<hr/>
</div>
<div id="intro"> <div id="intro">
<p>To cast a vote, you will be led through the following steps. If you have not yet logged in, you will be asked to do so at the very end of the process.</p> <p>To cast a vote, you will be led through the following steps. If you have not yet logged in, you will be asked to do so at the very end of the process.</p>
<ol> <ol>
......
...@@ -856,7 +856,15 @@ let make_login_box style auth links = ...@@ -856,7 +856,15 @@ let make_login_box style auth links =
pcdata "Please log in to confirm your vote."; pcdata "Please log in to confirm your vote.";
] ]
in in
let progress = div ~a:[a_style "text-align:center;margin-bottom:20px;"] [
pcdata "Introduction — Answer to questions — Review and encrypt";
pcdata " — Authenticate — ";
b [pcdata "Confirm"];
pcdata " — Done";
hr ();
] in
let content = [ let content = [
progress;
p [ p [
pcdata "Your ballot for "; pcdata "Your ballot for ";
em [pcdata name]; em [pcdata name];
...@@ -881,7 +889,14 @@ let make_login_box style auth links = ...@@ -881,7 +889,14 @@ let make_login_box style auth links =
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
let progress = div ~a:[a_style "text-align:center;margin-bottom:20px;"] [
pcdata "Introduction — Answer to questions — Review and encrypt";
pcdata " — Authenticate — Confirm — ";
b [pcdata "Done"];
hr ();
] in
let content = [ let content = [
progress;
p [ p [
pcdata "Your ballot for "; pcdata "Your ballot for ";
em [pcdata name]; em [pcdata name];
......
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