Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
b07b60c7
Commit
b07b60c7
authored
7 years ago
by
Shirlei Chaves
Browse files
Options
Downloads
Patches
Plain Diff
Make cast vote email a template
parent
0b7da7a9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
server_ui/glue.py
+12
-23
12 additions, 23 deletions
server_ui/glue.py
server_ui/templates/email/cast_vote_body.txt
+14
-0
14 additions, 0 deletions
server_ui/templates/email/cast_vote_body.txt
server_ui/templates/email/cast_vote_subject.txt
+1
-0
1 addition, 0 deletions
server_ui/templates/email/cast_vote_subject.txt
with
27 additions
and
23 deletions
server_ui/glue.py
+
12
−
23
View file @
b07b60c7
...
@@ -5,6 +5,7 @@ Glue some events together
...
@@ -5,6 +5,7 @@ Glue some events together
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.conf
import
settings
from
django.conf
import
settings
from
helios.view_utils
import
render_template_raw
import
helios.views
,
helios
.
signals
import
helios.views
,
helios
.
signals
import
views
import
views
...
@@ -12,30 +13,18 @@ import views
...
@@ -12,30 +13,18 @@ import views
def
vote_cast_send_message
(
user
,
voter
,
election
,
cast_vote
,
**
kwargs
):
def
vote_cast_send_message
(
user
,
voter
,
election
,
cast_vote
,
**
kwargs
):
## FIXME: this doesn't work for voters that are not also users
## FIXME: this doesn't work for voters that are not also users
# prepare the message
# prepare the message
subject
=
"
%s - vote cast
"
%
election
.
name
subject_template
=
'
email/cast_vote_subject.txt
'
body_template
=
'
email/cast_vote_body.txt
'
body
=
"""
You have successfully cast a vote in
extra_vars
=
{
'
election
'
:
election
,
%s
'
voter
'
:
voter
,
'
cast_vote
'
:
cast_vote
,
Your ballot is archived at:
'
cast_vote_url
'
:
helios
.
views
.
get_castvote_url
(
cast_vote
),
'
custom_subject
'
:
"
%s - vote cast
"
%
election
.
name
%s
}
"""
%
(
election
.
name
,
helios
.
views
.
get_castvote_url
(
cast_vote
))
subject
=
render_template_raw
(
None
,
subject_template
,
extra_vars
)
body
=
render_template_raw
(
None
,
body_template
,
extra_vars
)
if
election
.
use_voter_aliases
:
body
+=
"""
This election uses voter aliases to protect your privacy.
Your voter alias is : %s
"""
%
voter
.
alias
body
+=
"""
--
%s
"""
%
settings
.
SITE_TITLE
# send it via the notification system associated with the auth system
# send it via the notification system associated with the auth system
user
.
send_message
(
subject
,
body
)
user
.
send_message
(
subject
,
body
)
...
...
This diff is collapsed.
Click to expand it.
server_ui/templates/email/cast_vote_body.txt
0 → 100644
+
14
−
0
View file @
b07b60c7
Dear {{voter.name}},
You have successfully cast a vote in {{election.name}}.
Your ballot is archived at: {{cast_vote_url}}
{% if election.use_voter_aliases %}
This election uses voter aliases to protect your privacy.
Your voter alias is: {{voter.alias}}.
{% endif %}
--
Helios
This diff is collapsed.
Click to expand it.
server_ui/templates/email/cast_vote_subject.txt
0 → 100644
+
1
−
0
View file @
b07b60c7
{{custom_subject|safe}}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment