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
63e096c6
Commit
63e096c6
authored
Mar 28, 2014
by
Stephane Glondu
Browse files
Add {add,remove}_featured_election
parent
93ba37a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/web/web_signatures.mli
View file @
63e096c6
...
...
@@ -265,6 +265,8 @@ module type SITE = sig
featured
:
bool
->
election_files
->
(
module
WEB_ELECTION
)
option
Lwt
.
t
val
set_main_election
:
string
->
unit
Lwt
.
t
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
cont
:
(
unit
->
service_handler
)
Eliom_reference
.
eref
end
...
...
src/web/web_site.ml
View file @
63e096c6
...
...
@@ -34,6 +34,10 @@ module type CONFIG = sig
val
auth_config
:
auth_config
list
end
let
rec
list_remove
x
=
function
|
[]
->
[]
|
y
::
ys
->
if
x
=
y
then
ys
else
y
::
(
list_remove
x
ys
)
let
get_single_line
x
=
match_lwt
Lwt_stream
.
get
x
with
|
None
->
return
None
...
...
@@ -105,6 +109,20 @@ module Make (C : CONFIG) : SITE = struct
let
import_election
~
featured
f
=
!
import_election_ref
featured
f
let
add_featured_election
x
=
lwt
the_featured
=
Ocsipersist
.
get
featured
in
if
List
.
mem
x
the_featured
then
(
return
()
)
else
if
SMap
.
mem
x
!
election_table
then
(
Ocsipersist
.
set
featured
(
x
::
the_featured
)
)
else
(
Lwt
.
fail
Not_found
)
let
remove_featured_election
x
=
lwt
the_featured
=
Ocsipersist
.
get
featured
in
Ocsipersist
.
set
featured
(
list_remove
x
the_featured
)
let
set_main_election
x
=
if
SMap
.
mem
x
!
election_table
then
(
Ocsipersist
.
set
main_election
(
Some
x
)
...
...
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