From ca380aa70c2b5beae8df48de5b2f5a47a4ae6510 Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Mon, 27 Sep 2010 21:37:16 -0700
Subject: [PATCH] fixed email templates

---
 helios/templates/email/vote_body.txt    | 7 +++----
 helios/templates/email/vote_subject.txt | 2 +-
 helios/templates/voters_email.html      | 5 +++++
 helios/views.py                         | 4 +++-
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/helios/templates/email/vote_body.txt b/helios/templates/email/vote_body.txt
index daa9f74..301bc62 100644
--- a/helios/templates/email/vote_body.txt
+++ b/helios/templates/email/vote_body.txt
@@ -9,14 +9,13 @@ Your username: {{voter.user.user_id}}
 Your password: {{voter.user.info.password}}
 {% else %}
 Log in with your {{voter.voter_type}} account.
-{% endifequal %}
-{% if election.use_voter_aliases %}
-Your voter alias: {{voter.alias}}
-
+{% endifequal %}{% if election.use_voter_aliases %}
 In order to protect your privacy, this election is configured
 to never display your username, name, or email address to the public.
 Instead, the ballot tracking center will only display your alias.
 
+Your voter alias is {{voter.alias}}.
+
 IMPORTANTLY, when you are prompted to log in to vote,
 please use your *username*, not your alias.
 {% endif %}
diff --git a/helios/templates/email/vote_subject.txt b/helios/templates/email/vote_subject.txt
index 91486fc..0d51546 100644
--- a/helios/templates/email/vote_subject.txt
+++ b/helios/templates/email/vote_subject.txt
@@ -1 +1 @@
-vote in {{voter.election.name}}
+{{voter.election.name}} - {{custom_subject|safe}}
diff --git a/helios/templates/voters_email.html b/helios/templates/voters_email.html
index 515ce4f..53481f9 100644
--- a/helios/templates/voters_email.html
+++ b/helios/templates/voters_email.html
@@ -24,6 +24,11 @@ voter_id = '{{voter.voter_id}}';
     the election URL, the login information, and a simple email signature.<br />
     No need to include these in the body of your email below.
   </p>
+
+  <p>
+    The email will also <b><u>automatically</u></b> include the name of the election in the subject,<br />followed by your custom subject.
+  </p>
+  
   <form class="prettyform" action="" method="POST" id="email_form">
     <input type="hidden" name="csrf_token" value="{{csrf_token}}" />
     <table class="pretty">
diff --git a/helios/views.py b/helios/views.py
index c94871d..2e37026 100644
--- a/helios/views.py
+++ b/helios/views.py
@@ -916,8 +916,10 @@ def voters_email(request, election):
       body_template = 'email/vote_body.txt'
       
       extra_vars = {
+        'custom_subject' : email_form.cleaned_data['subject'],
         'custom_message' : email_form.cleaned_data['body'],
-        'election_url' : get_election_url(election)
+        'election_url' : get_election_url(election),
+        'election' : election
         }
         
 
-- 
GitLab