From 092c9f21b017dea735efa93720519d9820e7f597 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@BigDaddy.local> Date: Sun, 29 Nov 2009 15:16:37 -0800 Subject: [PATCH] moved single election stuff to multi election --- README.txt | 4 ++-- app.yaml.sample | 4 ++-- initialization.py.sample | 4 ++-- {single-election => server-ui}/__init__.py | 2 +- {single-election => server-ui}/glue.py | 0 .../media/.gitignore | 0 .../media/boothcss/booth.css | 0 .../media/boothcss/forms.css | 0 .../media/footer-logo.gif.sample | Bin .../media/logo.gif.sample | Bin {single-election => server-ui}/media/main.css | 0 .../templates/base.html | 0 .../templates/confirm.html | 4 ++-- .../templates/done.html | 2 +- .../templates/election_tallied.html | 2 +- .../templates/index.html | 11 +++++++--- {single-election => server-ui}/urls.py | 0 {single-election => server-ui}/view_utils.py | 2 +- {single-election => server-ui}/views.py | 20 ++++++------------ settings.py.sample | 2 +- urls.py | 2 +- 21 files changed, 28 insertions(+), 31 deletions(-) rename {single-election => server-ui}/__init__.py (62%) rename {single-election => server-ui}/glue.py (100%) rename {single-election => server-ui}/media/.gitignore (100%) rename {single-election => server-ui}/media/boothcss/booth.css (100%) rename {single-election => server-ui}/media/boothcss/forms.css (100%) rename {single-election => server-ui}/media/footer-logo.gif.sample (100%) rename {single-election => server-ui}/media/logo.gif.sample (100%) rename {single-election => server-ui}/media/main.css (100%) rename {single-election => server-ui}/templates/base.html (100%) rename {single-election => server-ui}/templates/confirm.html (81%) rename {single-election => server-ui}/templates/done.html (88%) rename {single-election => server-ui}/templates/election_tallied.html (87%) rename {single-election => server-ui}/templates/index.html (69%) rename {single-election => server-ui}/urls.py (100%) rename {single-election => server-ui}/view_utils.py (87%) rename {single-election => server-ui}/views.py (84%) diff --git a/README.txt b/README.txt index b1e9d94..c756b93 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -The Helios Single-Election Server -================================= +The Helios Election Server +========================== LICENSE: this code is released under the GPL v3 or later. \ No newline at end of file diff --git a/app.yaml.sample b/app.yaml.sample index a162a36..460b0a1 100644 --- a/app.yaml.sample +++ b/app.yaml.sample @@ -19,13 +19,13 @@ handlers: secure: always - url: /static - static_dir: single-election/media + static_dir: server-ui/media secure: always # this overrides the style for the booth # without having to fork the code - url: /booth/css - static_dir: single-election/media/boothcss + static_dir: server-ui/media/boothcss secure: always - url: /booth diff --git a/initialization.py.sample b/initialization.py.sample index 8454f77..06e4abf 100644 --- a/initialization.py.sample +++ b/initialization.py.sample @@ -7,9 +7,9 @@ import helios import auth import auth.models -#from single-election import glue +#from server-ui import glue -helios.TEMPLATE_BASE = "single-election/templates/base.html" +helios.TEMPLATE_BASE = "server-ui/templates/base.html" helios.ADMIN_ONLY = True helios.ADMIN = auth.models.User.get_or_create(user_type = 'cas', user_id = 'yaro', info={}) diff --git a/single-election/__init__.py b/server-ui/__init__.py similarity index 62% rename from single-election/__init__.py rename to server-ui/__init__.py index ac3c779..8b46056 100644 --- a/single-election/__init__.py +++ b/server-ui/__init__.py @@ -1,4 +1,4 @@ """ -This django app is meant only to connect the pieces of Helios and Auth that are specific to single election +This django app is meant only to connect the pieces of Helios and Auth to present a clean UI """ diff --git a/single-election/glue.py b/server-ui/glue.py similarity index 100% rename from single-election/glue.py rename to server-ui/glue.py diff --git a/single-election/media/.gitignore b/server-ui/media/.gitignore similarity index 100% rename from single-election/media/.gitignore rename to server-ui/media/.gitignore diff --git a/single-election/media/boothcss/booth.css b/server-ui/media/boothcss/booth.css similarity index 100% rename from single-election/media/boothcss/booth.css rename to server-ui/media/boothcss/booth.css diff --git a/single-election/media/boothcss/forms.css b/server-ui/media/boothcss/forms.css similarity index 100% rename from single-election/media/boothcss/forms.css rename to server-ui/media/boothcss/forms.css diff --git a/single-election/media/footer-logo.gif.sample b/server-ui/media/footer-logo.gif.sample similarity index 100% rename from single-election/media/footer-logo.gif.sample rename to server-ui/media/footer-logo.gif.sample diff --git a/single-election/media/logo.gif.sample b/server-ui/media/logo.gif.sample similarity index 100% rename from single-election/media/logo.gif.sample rename to server-ui/media/logo.gif.sample diff --git a/single-election/media/main.css b/server-ui/media/main.css similarity index 100% rename from single-election/media/main.css rename to server-ui/media/main.css diff --git a/single-election/templates/base.html b/server-ui/templates/base.html similarity index 100% rename from single-election/templates/base.html rename to server-ui/templates/base.html diff --git a/single-election/templates/confirm.html b/server-ui/templates/confirm.html similarity index 81% rename from single-election/templates/confirm.html rename to server-ui/templates/confirm.html index f453da6..3751490 100644 --- a/single-election/templates/confirm.html +++ b/server-ui/templates/confirm.html @@ -1,4 +1,4 @@ -{% extends 'single-election/templates/base.html' %} +{% extends 'server-ui/templates/base.html' %} {% block title %}Confirm Vote{% endblock %} {% block content %} @@ -38,7 +38,7 @@ function show_waiting() { </form> <p> - Forgot your password? <a href="{% url auth.auth_systems.password.password_forgotten_view %}?return_url={% url single-election.views.cast_confirm %}">Have it emailed to you</a>.<br />(don't worry, we won't forget your vote). + Forgot your password? <a href="{% url auth.auth_systems.password.password_forgotten_view %}?return_url={% url server-ui.views.cast_confirm %}">Have it emailed to you</a>.<br />(don't worry, we won't forget your vote). </p> </div> diff --git a/single-election/templates/done.html b/server-ui/templates/done.html similarity index 88% rename from single-election/templates/done.html rename to server-ui/templates/done.html index 0447034..9b3a2b3 100644 --- a/single-election/templates/done.html +++ b/server-ui/templates/done.html @@ -1,4 +1,4 @@ -{% extends 'single-election/templates/base.html' %} +{% extends 'server-ui/templates/base.html' %} {% block title %}Confirm Vote{% endblock %} {% block content %} diff --git a/single-election/templates/election_tallied.html b/server-ui/templates/election_tallied.html similarity index 87% rename from single-election/templates/election_tallied.html rename to server-ui/templates/election_tallied.html index 7b536c5..3a81953 100644 --- a/single-election/templates/election_tallied.html +++ b/server-ui/templates/election_tallied.html @@ -1,4 +1,4 @@ -{% extends 'single-election/templates/base.html' %} +{% extends 'server-ui/templates/base.html' %} {% block content %} diff --git a/single-election/templates/index.html b/server-ui/templates/index.html similarity index 69% rename from single-election/templates/index.html rename to server-ui/templates/index.html index 276dd15..7b866ec 100644 --- a/single-election/templates/index.html +++ b/server-ui/templates/index.html @@ -1,4 +1,4 @@ -{% extends 'single-election/templates/base.html' %} +{% extends 'server-ui/templates/base.html' %} {% block title %}{{ settings.SITE_TITLE }}{% endblock %} {% block header %} @@ -16,9 +16,14 @@ Learn more about Helios, and why secure voting matters, <a href="http://heliosvoting.org">here</a>. </p> + <p style="font-size: 1.4em;"> - Proceed to -<a href="{% url helios.views.one_election_view settings.SINGLE_ELECTION_UUID %}">the {{settings.SINGLE_ELECTION_TITLE}}</a>. +Current Elections: +<ul> +{% for election in elections %} + <li> <a href="{% url helios.views.one_election_view election.uuid %}">{{election.name}}</a></li> +{% endfor %} +</ul> </p> {% endblock %} diff --git a/single-election/urls.py b/server-ui/urls.py similarity index 100% rename from single-election/urls.py rename to server-ui/urls.py diff --git a/single-election/view_utils.py b/server-ui/view_utils.py similarity index 87% rename from single-election/view_utils.py rename to server-ui/view_utils.py index 98eec83..9a5b655 100644 --- a/single-election/view_utils.py +++ b/server-ui/view_utils.py @@ -26,5 +26,5 @@ def render_template(request, template_name, vars = {}): if request.session.has_key('csrf_token'): vars_with_user['csrf_token'] = request.session['csrf_token'] - return render_to_response('single-election/templates/%s.html' % template_name, vars_with_user) + return render_to_response('server-ui/templates/%s.html' % template_name, vars_with_user) diff --git a/single-election/views.py b/server-ui/views.py similarity index 84% rename from single-election/views.py rename to server-ui/views.py index 27a6c95..b8da4e0 100644 --- a/single-election/views.py +++ b/server-ui/views.py @@ -1,5 +1,5 @@ """ -single-election specific views +server-ui specific views """ from helios.models import * @@ -18,22 +18,14 @@ from django.conf import settings def get_election(): - return Election.get_by_key_name(settings.SINGLE_ELECTION_SHORT_NAME) + return None def home(request): - election_params = settings.SINGLE_ELECTION_PARAMS + # load the featured elections + featured_elections = [Election.get_by_key_name(uuid) for uuid in settings.FEATURED_ELECTION_UUIDS] + featured_elections = [e for e in featured_elections if e != None] - # let's not do this - - # election_params['cast_url'] = settings.URL_HOST + reverse(cast) - election_params['cast_url'] = settings.URL_HOST + reverse(helios.views.one_election_cast, args=[election_params['uuid']]) - - election_params['admin'] = helios.ADMIN - - # create the election if need be - election, created_p = Election.get_or_create(**election_params) - - return render_template(request, "index") + return render_template(request, "index", {'elections': featured_elections}) def about(request): return HttpResponse(request, "about") diff --git a/settings.py.sample b/settings.py.sample index bc7f7e8..00b4727 100644 --- a/settings.py.sample +++ b/settings.py.sample @@ -117,7 +117,7 @@ INSTALLED_APPS = ( 'appengine_django', 'auth', 'helios', - 'single-election', + 'server-ui', ) diff --git a/urls.py b/urls.py index 60e123f..eb46fe6 100644 --- a/urls.py +++ b/urls.py @@ -5,5 +5,5 @@ from django.contrib import admin urlpatterns = patterns('', (r'^auth/', include('auth.urls')), (r'^helios/', include('helios.urls')), - (r'^', include('single-election.urls')), + (r'^', include('server-ui.urls')), ) \ No newline at end of file -- GitLab