Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
0595675f
Commit
0595675f
authored
Aug 04, 2014
by
Stephane Glondu
Browse files
Clearer form for featuring an election
parent
33cb654b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/web/web_election.ml
View file @
0595675f
...
...
@@ -392,7 +392,8 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
)
in
Redirection
.
send
W
.
S
.
admin
)
in
T
.
admin
~
set_featured
()
lwt
is_featured
=
S
.
is_featured_election
uuid
in
T
.
admin
~
set_featured
~
is_featured
()
|
_
->
forbidden
()
)
...
...
src/web/web_signatures.mli
View file @
0595675f
...
...
@@ -262,6 +262,7 @@ module type ELECTION_TEMPLATES = sig
[
`One
of
bool
]
Eliom_parameter
.
param_name
,
[
<
Eliom_service
.
registrable
]
,
'
c
)
Eliom_service
.
service
->
is_featured
:
bool
->
unit
->
[
>
`Html
]
Eliom_content
.
Html5
.
F
.
elt
Lwt
.
t
val
update_credential
:
...
...
@@ -330,6 +331,7 @@ module type SITE = sig
val
unset_main_election
:
unit
->
unit
Lwt
.
t
val
add_featured_election
:
string
->
unit
Lwt
.
t
val
remove_featured_election
:
string
->
unit
Lwt
.
t
val
is_featured_election
:
string
->
bool
Lwt
.
t
val
cont
:
(
unit
->
service_handler
)
Eliom_reference
.
eref
end
...
...
src/web/web_site.ml
View file @
0595675f
...
...
@@ -153,6 +153,10 @@ module Make (C : CONFIG) : SITE = struct
lwt
the_featured
=
Ocsipersist
.
get
featured
in
Ocsipersist
.
set
featured
(
list_remove
x
the_featured
)
let
is_featured_election
x
=
lwt
the_featured
=
Ocsipersist
.
get
featured
in
return
(
List
.
mem
x
the_featured
)
let
set_main_election
x
=
if
SMap
.
mem
x
!
election_table
then
(
Ocsipersist
.
set
main_election
(
Some
x
)
...
...
src/web/web_templates.ml
View file @
0595675f
...
...
@@ -438,12 +438,13 @@ module Make (S : SITE_SERVICES) : TEMPLATES = struct
lwt
login_box
=
election_login_box
()
in
base
~
title
:
params
.
e_name
~
login_box
~
content
let
admin
~
set_featured
()
=
let
admin
~
set_featured
~
is_featured
()
=
let
title
=
W
.
election
.
e_params
.
e_name
^
" — Administration"
in
let
feature_form
=
post_form
~
service
:
set_featured
(
fun
featured
->
[
bool_checkbox
~
name
:
featured
()
;
string_input
~
input_type
:
`Submit
~
value
:
"(Un)feature"
()
;
bool_checkbox
~
name
:
featured
~
checked
:
is_featured
()
;
pcdata
"Feature this election "
;
string_input
~
input_type
:
`Submit
~
value
:
"Apply"
()
;
])
()
in
let
content
=
[
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment