Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webapp/pollster/templates/pollster-assigned-polls.html
blob: 49402731622cd917d58418330927a995e134ff0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{% extends "base-poll.html" %}

{% block main_container %}
    <script src="{{ STATIC_URL }}js/angular.min.js"></script>

    <div ng-app="pollster-assigned-polls">

        <div  ng-controller="CollapseCtrl">

            <h2 class="well well-small open" ng-click="sort_by('open')" style="cursor: pointer;"><i class="icon-chevron-down">&nbsp;</i>Abiertas, asignadas a usted</h2>

            <div collapse="isCollapsed">
                {% if open_polls|length %}
                <table class="table table-hover table-bordered">
                    <thead>
                        <tr>
                            <th class="span5">Nombre</th>
                            <th class="span5"><center>DescripciĆ³n</center></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for poll in open_polls %}
                            <tr>
                                <td>{{ poll.name|capfirst }}</td>
                                <td>Esta encuesta est&aacute; en proceso de elavoraci&oacute;n.</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
                {% else %}
                    <div class="alert">
                      No existen encuestas abiertas y asociadas a usted, por el momento.
                    </div>
                {% endif %}
            </div>

        </div>

        <div ng-controller="CollapseCtrl">

            <h2 class="well well-small closed" ng-init="sort_by('closed')" ng-click="sort_by('closed')" style="cursor: pointer;"><i class="icon-chevron-down"></i>&nbsp;Cerradas o terminadas</h2>

            <div collapse="isCollapsed">
                {% if closed_polls|length %}
                <table class="table table-hover table-bordered">
                    <thead>
                        <tr>
                            <th class="span5">Nombre</th>
                            <th><center>Resultados</center></th>
                            <th class="span5"><center>Acciones</center></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for poll in closed_polls %}
                            <tr>
                                <td>{{ poll.name|capfirst }}</td>
                                <td>{% if poll.get_result %}Existen resultados para esta encuesta y pueden ser visualizados por los sociologos.{% else %}No tiene resultados.{% endif %}</td>
                                <td>
                                    <a class="btn" href="{% url pollsters:poll_download poll_id=poll.id %}">
                                        <i class="icon-download-alt"></i>&nbsp;Descargar encuesta
                                    </a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
                {% else %}
                    <div class="alert">
                      No existen encuestas asignadas a usted que pueda realizar, por el momento.
                    </div>
                {% endif %}
            </div>

        </div>

    </div>

    <script src="{{ STATIC_URL }}js/ui-bootstrap-0.2.0.min.js"></script>
    <script src="{{ STATIC_URL }}js/ui-bootstrap-tpls-0.2.0.min.js"></script>

    <script type="text/javascript">

        angular.module('pollster-assigned-polls', ['ui.bootstrap']);

        function CollapseCtrl($scope) {
            $scope.isCollapsed = true;

            $scope.sort_by = function(class_) {

                $scope.isCollapsed = !$scope.isCollapsed;

                if ($scope.isCollapsed)
                    $('h2.' + class_ + " i").removeClass().addClass('icon-chevron-down');
                else
                    $('h2.' + class_ + " i").removeClass().addClass('icon-chevron-up');
            }

        }

    </script>

{% endblock %}