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
45b5ee7b
Commit
45b5ee7b
authored
Dec 11, 2012
by
Stephane Glondu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Helios_templates.index
parent
49936bc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
17 deletions
+106
-17
helios/src/helios_templates.ml
helios/src/helios_templates.ml
+75
-10
src/helios_registration.ml
src/helios_registration.ml
+19
-5
src/helios_services.ml
src/helios_services.ml
+12
-2
No files found.
helios/src/helios_templates.ml
View file @
45b5ee7b
open
Eliom_content
.
Html5
.
D
open
Eliom_content
.
Html5
.
F
let
site_title
=
"Helios Election Server"
let
welcome_message
=
"This is the default message"
let
base
~
title
~
header
~
content
=
let
s
x
=
Xml
.
uri_of_string
(
"/static/"
^
x
)
in
html
(
head
(
Eliom_content
.
Html5
.
F
.
title
(
pcdata
title
))
[
(
head
(
Eliom_content
.
Html5
.
F
.
title
(
pcdata
(
title
^
" - Helios"
)
))
[
link
~
rel
:
[
`Stylesheet
]
~
href
:
(
s
"main.css"
)
...
...
@@ -24,11 +27,12 @@ let base ~title ~header ~content =
(
body
[
div
~
a
:
[
a_id
"content"
]
[
div
~
a
:
[
a_id
"header"
]
([
a
~
service
:
Helios_services
.
home_s
[
img
~
src
:
(
s
"logo.gif"
)
~
a
:
[
a_style
"border:0;"
;
a_height
110
]
~
alt
:
"Helios"
()
]
()
;
a
~
service
:
Helios_services
.
home
[
img
~
src
:
(
s
"logo.gif"
)
~
a
:
[
a_style
"border:0;"
;
a_height
110
]
~
alt
:
"Helios"
()
]
()
;
br
()
;
]
@
header
);
div
~
a
:
[
a_id
"contentbody"
]
content
;
...
...
@@ -37,11 +41,72 @@ let base ~title ~header ~content =
(* if user/voter... *)
pcdata
"not logged in."
;
br
()
;
a
~
service
:
Helios_services
.
heliosvotingorg_s
[
pcdata
"About Helios"
]
()
;
a
~
service
:
Helios_services
.
heliosvotingorg
[
pcdata
"About Helios"
]
()
;
(* footer links *)
br
~
a
:
[
a_style
"clear:right;"
]
()
;
];
];
])
let
index
~
user
~
featured
=
base
~
title
:
site_title
~
header
:
[
h2
[
pcdata
site_title
]]
~
content
:
(
let
user_box
=
match
user
with
|
`User
(
user
,
administered
,
voted
)
->
let
administration_box
=
match
administered
with
|
Some
admin
->
let
administered_box
=
match
admin
with
|
_
::_
->
ul
admin
|
[]
->
em
[
pcdata
"none yet"
]
in
[
h4
[
pcdata
"Administration"
];
administered_box
;
p
[
pcdata
"["
;
a
~
service
:
Helios_services
.
elections_administered
[
pcdata
"see all"
]
()
;
pcdata
"]"
];
div
~
a
:
[
a_style
"text-align:right;"
]
[
a
~
service
:
Helios_services
.
election_new
~
a
:
[
a_style
"font-size: 1.2em; padding:5px; background: #eee; border: 1px solid #888;"
]
[
pcdata
"create election >"
;
]
()
;
]
]
|
None
->
[]
in
let
recent_votes
=
[
h4
[
pcdata
"Recent votes"
];
match
voted
with
|
_
::_
->
ul
voted
|
[]
->
em
[
pcdata
"none yet"
]
]
in
[
div
~
a
:
[
a_style
"font-size:1.4em;"
;
a_class
[
"highlight-box"
]]
user
]
@
administration_box
@
recent_votes
|
`Login
login_box
->
[
h3
[
pcdata
"Log In to Start Voting"
]]
@
login_box
@
[
br
()
;
br
()
]
in
let
featured_box
=
match
featured
with
|
_
::_
->
[
h3
[
pcdata
"Currently Featured Elections"
];
p
featured
;
]
|
[]
->
[
h4
[
pcdata
"no featured elections at the moment"
];
]
in
[
div
~
a
:
[
a_id
"mystuff"
]
user_box
;
p
~
a
:
[
a_style
"font-size: 1.4em;"
]
[
pcdata
welcome_message
];
div
featured_box
;
br
~
a
:
[
a_style
"clear:right;"
]
()
;
br
()
]
)
src/helios_registration.ml
View file @
45b5ee7b
let
()
=
Eliom_registration
.
Html5
.
register
~
service
:
Helios_services
.
home_s
(
fun
()
()
->
Lwt
.
return
(
Helios_templates
.
base
~
title
:
"Helios Election Server"
~
header
:
[]
~
content
:
[]
))
Eliom_registration
.
Html5
.
register
~
service
:
Helios_services
.
home
(
fun
()
()
->
Lwt
.
return
(
Helios_templates
.
index
~
user
:
(
`Login
[]
)
~
featured
:
[]
))
let
()
=
Eliom_registration
.
Html5
.
register
~
service
:
Helios_services
.
elections_administered
(
fun
()
()
->
Lwt
.
return
(
Helios_templates
.
index
~
user
:
(
`Login
[]
)
~
featured
:
[]
))
let
()
=
Eliom_registration
.
Html5
.
register
~
service
:
Helios_services
.
election_new
(
fun
()
()
->
Lwt
.
return
(
Helios_templates
.
index
~
user
:
(
`Login
[]
)
~
featured
:
[]
))
src/helios_services.ml
View file @
45b5ee7b
open
Eliom_service
open
Eliom_parameter
let
heliosvotingorg
_s
=
external_service
let
heliosvotingorg
=
external_service
~
prefix
:
"http://heliosvoting.org"
~
path
:
[]
~
get_params
:
unit
()
let
home
_s
=
service
let
home
=
service
~
path
:
[]
~
get_params
:
unit
()
let
elections_administered
=
service
~
path
:
[
"elections"
;
"administered"
]
~
get_params
:
unit
()
let
election_new
=
service
~
path
:
[
"elections"
;
"new"
]
~
get_params
:
unit
()
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