Commit 206ff824 authored by Stephane Glondu's avatar Stephane Glondu

Remove new_election page

parent 1317885b
......@@ -33,8 +33,6 @@ let logout = service ~path:["logout"] ~get_params:unit ()
let source_code = service ~path:["belenios.tar.gz"] ~get_params:unit ()
let get_randomness = service ~path:["get-randomness"] ~get_params:unit ()
let new_election = service ~path:["new-election"] ~get_params:unit ()
let tool = preapply (static_dir ()) ["static"; "belenios-tool.html"]
let election_setup_new = post_coservice ~csrf_safe:true ~fallback:admin ~post_params:unit ()
......
......@@ -299,13 +299,6 @@ let () = String.register
(fun x -> return (x, "application/json"))
)
let () = Html5.register ~service:new_election
(fun () () ->
match_lwt Web_auth_state.get_site_user () with
| None -> forbidden ()
| Some _ -> T.new_election ()
)
let generate_uuid = Uuidm.v4_gen (Random.State.make_self_init ())
let () = Redirection.register ~service:election_setup_new
......
......@@ -191,6 +191,13 @@ let admin ~elections () =
lwt login_box = site_login_box () in
base ~title ~login_box ~content ()
| Some (elections, setup_elections) ->
let setup_form = post_form ~service:election_setup_new
(fun () ->
[
div [string_input ~a:[a_style "font-size:24px;"] ~input_type:`Submit ~value:"Prepare a new election" ()]
]
) ()
in
let elections =
match elections with
| [] -> p [pcdata "You own no such elections!"]
......@@ -206,9 +213,11 @@ let admin ~elections () =
in
let content = [
div [
div [a ~service:new_election [pcdata "Create a new election"] ()];
div [setup_form];
div [br ()];
h2 [pcdata "Elections being prepared"];
setup_elections;
div [br ()];
h2 [pcdata "Elections you can administer"];
elections;
];
......@@ -225,25 +234,6 @@ let make_button ~service contents =
uri
contents
let new_election () =
let title = "Create new election" in
lwt body =
let setup_form = post_form ~service:election_setup_new
(fun () ->
[
h2 [pcdata "Prepare a new election"];
div [string_input ~input_type:`Submit ~value:"Prepare a new election" ()]
]
) ()
in
return [setup_form]
in
let content = [
div body;
] in
lwt login_box = site_login_box () in
base ~title ~login_box ~content ()
let new_election_failure reason () =
let title = "Create new election" in
let reason =
......
......@@ -24,7 +24,6 @@ open Web_signatures
val home : featured:(module WEB_ELECTION) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val admin : elections:((module WEB_ELECTION) list * Uuidm.t list) option -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val new_election : unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val new_election_failure : [ `Exists | `Exception of exn ] -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val generic_page : title:string -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......
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