Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
belenios
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
belenios
belenios
Commits
f708a69e
Commit
f708a69e
authored
Jul 15, 2015
by
Stephane Glondu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Web_templates.admin can distinguish whether an admin is logged in
parent
06d7f146
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
22 deletions
+25
-22
src/web/web_site.ml
src/web/web_site.ml
+18
-20
src/web/web_templates.ml
src/web/web_templates.ml
+6
-1
src/web/web_templates.mli
src/web/web_templates.mli
+1
-1
No files found.
src/web/web_site.ml
View file @
f708a69e
...
...
@@ -252,28 +252,26 @@ let () = Html5.register ~service:admin
lwt
site_user
=
Web_auth_state
.
get_site_user
()
in
lwt
elections
=
match
site_user
with
|
None
->
return
[]
|
None
->
return
None
|
Some
u
->
SMap
.
fold
(
fun
_
w
accu
->
let
module
W
=
(
val
w
:
WEB_ELECTION
)
in
if
W
.
metadata
.
e_owner
=
Some
u
then
(
w
::
accu
)
else
(
accu
)
)
!
election_table
[]
|>
List
.
rev
|>
return
in
lwt
setup_elections
=
match
site_user
with
|
None
->
return
[]
|
Some
u
->
Ocsipersist
.
fold_step
(
fun
k
v
accu
->
if
v
.
se_owner
=
u
then
return
(
uuid_of_string
k
::
accu
)
else
return
accu
)
election_stable
[]
lwt
elections
=
SMap
.
fold
(
fun
_
w
accu
->
let
module
W
=
(
val
w
:
WEB_ELECTION
)
in
if
W
.
metadata
.
e_owner
=
Some
u
then
(
w
::
accu
)
else
(
accu
)
)
!
election_table
[]
|>
List
.
rev
|>
return
and
setup_elections
=
Ocsipersist
.
fold_step
(
fun
k
v
accu
->
if
v
.
se_owner
=
u
then
return
(
uuid_of_string
k
::
accu
)
else
return
accu
)
election_stable
[]
in
return
@@
Some
(
elections
,
setup_elections
)
in
T
.
admin
~
elections
~
setup_elections
()
T
.
admin
~
elections
()
)
let
()
=
File
.
register
...
...
src/web/web_templates.ml
View file @
f708a69e
...
...
@@ -176,8 +176,13 @@ let home ~featured () =
let
login_box
=
pcdata
""
in
base
~
title
:
site_title
~
login_box
~
content
()
let
admin
~
elections
~
setup_elections
()
=
let
admin
~
elections
()
=
let
title
=
site_title
^
" — Administration"
in
let
elections
,
setup_elections
=
match
elections
with
|
None
->
[]
,
[]
|
Some
(
x
,
y
)
->
x
,
y
in
let
elections
=
match
elections
with
|
[]
->
p
[
pcdata
"You own no such elections!"
]
...
...
src/web/web_templates.mli
View file @
f708a69e
...
...
@@ -22,7 +22,7 @@
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
->
setup_elections
:
(
Uuidm
.
t
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
...
...
Write
Preview
Markdown
is supported
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