From c919f64c2307b14c37aa2708222e84333cdf5a73 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Wed, 27 Oct 2010 18:18:59 -0700 Subject: [PATCH] added options to badge --- helios/templates/election_badge.html | 6 +++--- helios/views.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/helios/templates/election_badge.html b/helios/templates/election_badge.html index dcdc4c2..3af1b6a 100644 --- a/helios/templates/election_badge.html +++ b/helios/templates/election_badge.html @@ -1,3 +1,3 @@ -<h3 style="padding:0; margin:0">{{election.name}}</h3> -<b>{{election.num_cast_votes}}</b> cast votes. [<a href="{{election_url}}">vote!</a>]<br /> -<span style="font-size:0.7em;">powered by <a href="http://heliosvoting.org">Helios Voting</a></span> +{% if show_title %}<h3 style="padding:0; margin:0">{{election.name}}</h3>{% endif %} +<b>{{election.num_cast_votes}}</b> cast votes.{% if show_vote_link %} [<a target="_top" href="{{election_url}}">vote!</a>]{% endif %}<br /> +<span style="font-size:0.7em;">powered by <a target="_top" href="http://heliosvoting.org">Helios Voting</a></span> diff --git a/helios/views.py b/helios/views.py index e486fa3..3a1819d 100644 --- a/helios/views.py +++ b/helios/views.py @@ -195,7 +195,10 @@ def one_election(request, election): @election_view() def election_badge(request, election): election_url = get_election_url(election) - return render_template(request, "election_badge", {'election': election, 'election_url': election_url}) + params = {'election': election, 'election_url': election_url} + for option_name in ['show_title', 'show_vote_link']: + params[option_name] = (request.GET.get(option_name, '1') == '1') + return render_template(request, "election_badge", params) @election_view() def one_election_view(request, election): -- GitLab