Skip to content
Snippets Groups Projects
Commit 112d035b authored by edmarmartineli's avatar edmarmartineli Committed by GitHub
Browse files

Merge branch 'master' into list_vote

parents 1bfc247a 44f26cd0
Branches
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
<h4>
{#if $T.admin_p}[
{#if $T.question$index > 0}<a href="javascript:question_move_up({$T.question$index});">^</a>]&nbsp;[{#/if}
<a href="javascript:question_remove({$T.question$index})">x</a>] [<a href="javascript:question_edit({$T.question$index})">edit</a>] {#/if}{$T.question$index + 1}. {$T.question.question} ({$T.question.choice_type}, select between {$T.question.min} and {#if $T.question.max != null}{$T.question.max}{#else}unlimited{#/if} answers, result type {$T.question.result_type}.)</h4>
<a onclick="return confirm('Are you sure you want to remove this question?');" href="javascript:question_remove({$T.question$index})">x</a>] [<a href="javascript:question_edit({$T.question$index})">edit</a>] {#/if}{$T.question$index + 1}. {$T.question.question} ({$T.question.choice_type}, select between {$T.question.min} and {#if $T.question.max != null}{$T.question.max}{#else}unlimited{#/if} answers, result type {$T.question.result_type}.)</h4>
<ul>
{#foreach $T.question.answers as answer}
<li> {$T.answer}
......
......
......@@ -49,14 +49,20 @@
new_q.answer_urls[i-1] = form['answer_url_' +i].value;
}
if (new_q.answers.length == 0) {
return null;
}
return new_q;
}
function question_add(form) {
var new_q = get_question_from_form(form);
if (new_q) {
QUESTIONS.push(new_q);
save_questions(refresh);
}
}
function question_remove(q_num) {
var new_questions = [];
......
......
......@@ -42,7 +42,7 @@ this {{election.election_type}} is <u>not</u> featured on the front page.
<br clear="left" />
<div style="margin-bottom: 25px; ">
<div style="margin-bottom: 25px; line-height: 1.3;">
{{election.description_bleached|safe}}
</div>
......
......
......@@ -5,7 +5,7 @@
<ul>
{% for election in elections %}
<li> <a href="{% url "helios.views.one_election_view" election.uuid %}">{{election.name}}</a></li>
<li> <a href="{% url "helios.views.one_election_view" election.uuid %}">{{election.name}}</a><em> - {{election.num_voters}} voters / {{election.num_cast_votes}} cast votes</em></li>
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
......@@ -10,6 +10,9 @@
<form method="POST" action="">
<input type="hidden" name="csrf_token" value="{{csrf_token}}" />
<p>
<input type="checkbox" name="send_email" value="send_email" checked="checked"/> Send email to voters reporting release of result.
</p>
<input type="submit" value="release result!" />
</form>
......
......
......@@ -47,7 +47,7 @@ You may tweak the subject and add a custom message using the form below.
{{email_form.as_table}}
</table>
<div>
<label for="">&nbsp;</label><input type="submit" value="Send" id="send_button" />
<label for="">&nbsp;</label><input type="submit" value="Send" id="send_button" class="button" />
</div>
</form>
......
......
......@@ -130,7 +130,9 @@ Voters {{voters_page.start_index}} - {{voters_page.end_index}} (of {{total_voter
{% if admin_p or not election.use_voter_aliases %}
{% if admin_p %}
<td style="white-space: nowrap;">
{% if election.frozen_at %}
[<a href="{% url "helios.views.voters_email" election.uuid %}?voter_id={{voter.voter_login_id}}">email</a>]
{% endif %}
[<a onclick="return confirm('are you sure you want to remove {{voter.name}} ?');" href="{% url "helios.views.voter_delete" election.uuid voter.uuid %}">x</a>]
</td>
<td>{{voter.voter_login_id}}</td>
......
......
......@@ -598,6 +598,14 @@ def password_voter_login(request, election):
})
return HttpResponseRedirect(settings.SECURE_URL_HOST + redirect_url)
else:
# bad form, bad voter login
redirect_url = login_url + "?" + urllib.urlencode({
'bad_voter_login' : '1',
'return_url' : return_url
})
return HttpResponseRedirect(settings.SECURE_URL_HOST + redirect_url)
return HttpResponseRedirect(settings.SECURE_URL_HOST + return_url)
......@@ -870,12 +878,28 @@ def voter_delete(request, election, voter_uuid):
voter = Voter.get_by_election_and_uuid(election, voter_uuid)
if voter:
voter.delete()
if election.frozen_at:
if voter.vote_hash:
# send email to voter
subject = "Vote removed"
body = """
Your vote were removed from the election "%s".
--
Helios
""" % (election.name)
voter.user.send_message(subject, body)
# log it
election.append_log("Voter %s/%s and their vote were removed after election frozen" % (voter.voter_type,voter.voter_id))
elif election.frozen_at:
# log it
election.append_log("Voter %s/%s removed after election frozen" % (voter.voter_type,voter.voter_id))
voter.delete()
return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid]))
@election_admin(frozen=False)
......@@ -1103,6 +1127,9 @@ def release_result(request, election):
election.release_result()
election.save()
if request.POST.get('send_email', ''):
return HttpResponseRedirect("%s?%s" % (settings.SECURE_URL_HOST + reverse(voters_email, args=[election.uuid]),urllib.urlencode({'template': 'result'})))
else:
return HttpResponseRedirect("%s" % (settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid])))
# if just viewing the form or the form is not valid
......@@ -1343,7 +1370,7 @@ def voters_email(request, election):
})
if request.method == "GET":
email_form = forms.EmailVotersForm()
email_form = forms.EmailVotersForm(initial={'subject': election.name, 'body': ' '})
if voter:
email_form.fields['send_to'].widget = email_form.fields['send_to'].hidden_widget()
else:
......
......
{% if default_auth_system %}
<p><a style="font-size:1.3em; border: 1px solid #bbb; padding: 5px;" href="{% url "helios_auth.views.start" system_name=default_auth_system %}?return_url={{return_url}}">{{default_auth_system_obj.LOGIN_MESSAGE}}</a></p>
<p>
<a class="small button" href="{% url "helios_auth.views.start" system_name=default_auth_system %}?return_url={{return_url}}">Log in</a></p>
{% else %}
{% for auth_system in enabled_auth_systems %}
{% ifequal auth_system "password" %}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment