Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRogelio Mita <rogeliomita@activitycentral.com>2013-09-05 15:55:22 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-09-05 15:55:22 (GMT)
commit1f052544b0ad2a1d1eb07da13e05577ff2792d8b (patch)
tree645ae398e2a96d261f5a307bfd327081ad49ae20
parentdfe685234fa35636e2961b09572ee2a8a861e727 (diff)
Feature: Button for download results as csv, Scenario:Visit Resultados page with at least one .poll_result
-rw-r--r--webapp/sociologist/templates/poll-result-list.html61
-rw-r--r--webapp/sociologist/views.py1
-rw-r--r--webapp/webapp/features/steps.py5
3 files changed, 45 insertions, 22 deletions
diff --git a/webapp/sociologist/templates/poll-result-list.html b/webapp/sociologist/templates/poll-result-list.html
index 483bc82..77f5cb2 100644
--- a/webapp/sociologist/templates/poll-result-list.html
+++ b/webapp/sociologist/templates/poll-result-list.html
@@ -1,26 +1,43 @@
{% extends "base-poll.html" %}
+{% block extra_css %}
+<style type="text/css">
+ .row-fluid {padding: 10px 0px 10px 0px;}
+</style>
+{% endblock %}
+
{% block main_container %}
-<table class="table table-condensed table-hover table-bordered">
- <thead>
- <tr>
- <th>N&uacute;mero de escuela</th>
- <th>Nombre de Encuestador</th>
- <th>Cantidad de Encuestados</th>
- <th>Nombre del Archivo .polls_results</th>
- <th>Time Stamp</th>
- </tr>
- </thead>
- <tbody>
- {% for poll_result in poll_results %}
- <tr>
- <td>{{ poll_result.numero_escuela }}</td>
- <td>{{ poll_result.pollster }}</td>
- <td>{{ poll_result.cantidad_encuestados }}</td>
- <td>{{ poll_result.file_name }}</td>
- <td>{{ poll_result.upload_timestamp }}</td>
- </tr>
- {% endfor %}
- </tbody>
-</table>
+<div class="row-fluid">
+ <center>
+ <a name="download_results_as_csv" class="btn btn-default" href="{% url sociologist:csv_download poll_id %}">
+ <i class="icon-download"></i>&nbsp;Descargar resultados (csv)
+ </a>
+ </center>
+</div>
+<div class="row-fluid">
+ <div class="span12">
+ <table class="table table-condensed table-hover table-bordered">
+ <thead>
+ <tr>
+ <th>N&uacute;mero de escuela</th>
+ <th>Nombre de Encuestador</th>
+ <th>Cantidad de Encuestados</th>
+ <th>Nombre del Archivo .polls_results</th>
+ <th>Time Stamp</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for poll_result in poll_results %}
+ <tr>
+ <td>{{ poll_result.numero_escuela }}</td>
+ <td>{{ poll_result.pollster }}</td>
+ <td>{{ poll_result.cantidad_encuestados }}</td>
+ <td>{{ poll_result.file_name }}</td>
+ <td>{{ poll_result.upload_timestamp }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+</div>
{% endblock %} \ No newline at end of file
diff --git a/webapp/sociologist/views.py b/webapp/sociologist/views.py
index a19a215..cc0c1fc 100644
--- a/webapp/sociologist/views.py
+++ b/webapp/sociologist/views.py
@@ -62,6 +62,7 @@ class PollResultListView(TemplateView):
poll_results.append(poll_result)
context['poll_results'] = poll_results
+ context['poll_id'] = str(poll.id)
return context
diff --git a/webapp/webapp/features/steps.py b/webapp/webapp/features/steps.py
index 83a40bb..cd864aa 100644
--- a/webapp/webapp/features/steps.py
+++ b/webapp/webapp/features/steps.py
@@ -46,6 +46,11 @@ def create_poll(name, status=Poll.OPEN):
world.poll_id = poll.save()
+@step(u'And "([^"]*)" exists')
+def and_poll_name_exists(step, poll_name):
+ create_poll(poll_name)
+
+
@step(u'And "([^"]*)" is "([^"]*)"')
def and_poll_is_status(step, poll_name, status):
status = Poll.CLOSED if status == "Cerrada" else Poll.OPEN