Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit bd7ca6da authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Set name and description of the election directly on setup page

parent 84d12881
......@@ -41,6 +41,7 @@ let election_setup_group = post_coservice ~fallback:election_setup ~post_params:
let election_setup_metadata = post_coservice ~fallback:election_setup ~post_params:(string "metadata") ()
let election_setup_questions = service ~path:["setup"; "questions"] ~get_params:(uuid "uuid") ()
let election_setup_questions_post = post_coservice ~fallback:election_setup_questions ~post_params:(string "questions") ()
let election_setup_description = post_coservice ~fallback:election_setup ~post_params:(string "name" ** string "description") ()
let election_setup_voters = service ~path:["setup"; "voters"] ~get_params:(uuid "uuid") ()
let election_setup_voters_post = post_service ~fallback:election_setup_voters ~post_params:(string "voters") ()
let election_setup_trustee_add = post_coservice ~fallback:election_setup ~post_params:unit ()
......
......@@ -372,6 +372,16 @@ let handle_setup f cont uuid x =
)
| None -> forbidden ()
let () =
Any.register
~service:election_setup_description
(handle_setup
(fun se (name, description) _ _ ->
se.se_questions <- {se.se_questions with
t_name = name;
t_description = description;
}) election_setup)
let () =
Any.register
~service:election_setup_group
......
......@@ -271,6 +271,34 @@ let election_setup uuid se () =
]
) ()
in
let form_description =
post_form ~service:election_setup_description
(fun (name, description) ->
[
div [
pcdata "Name of the election: ";
string_input ~name:name
~input_type:`Text ~value:se.se_questions.t_name ();
];
div [
div [pcdata "Description of the election: "];
div [
textarea ~name:description ~a:[a_cols 80]
~value:se.se_questions.t_description ();
];
];
div [
string_input ~input_type:`Submit ~value:"Submit" ();
];
]
) uuid
in
let div_description =
div [
h2 [pcdata "Name and description of the election"];
form_description;
]
in
let form_group =
make_form
~a:[a_style "display: none;"]
......@@ -458,6 +486,8 @@ let election_setup uuid se () =
) uuid
in
let content = [
div_description;
hr ();
div_questions;
hr ();
div_voters;
......
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