Browse Source

Permitindo a visualização dos graficos

pesquisas
Breno Teixeira 11 years ago
parent
commit
cc199807ec
  1. 17
      sigi/apps/pesquisas/templates/admin/forms/entries.html
  2. 28
      sigi/apps/pesquisas/templates/pesquisas/chart.html
  3. 2
      sigi/apps/pesquisas/views.py
  4. 2
      sigi/urls.py

17
sigi/apps/pesquisas/templates/admin/forms/entries.html

@ -26,6 +26,7 @@ td.include, th.include-all, td.include-all {text-align:center; width:10px;}
.button {float:left !important; margin-right:10px; cursor:pointer;} .button {float:left !important; margin-right:10px; cursor:pointer;}
</style> </style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}admin/js/admin/RelatedObjectLookups.js"></script>
<script> <script>
$(function() { $(function() {
// Show the filter criteria fields when a filter option is selected. // Show the filter criteria fields when a filter option is selected.
@ -87,20 +88,24 @@ $(function() {
<tr> <tr>
<th>{% trans "Field" %}</th> <th>{% trans "Field" %}</th>
<th>{% trans "Include" %}</th> <th>{% trans "Include" %}</th>
<th class="last" colspan="2">{% trans "Filter by" %}</th> <th colspan="2">{% trans "Filter by" %}</th>
<th class="last">{% trans "Graphic" %}</th>
</tr> </tr>
{% for include_field, filter_field, filter_option_fields in entries_form %} {% for include_field, graphic_field, filter_field, filter_option_fields in entries_form %}
<tr class="{% cycle on,off as row %}"> <tr class="{% cycle on,off as row %}">
<td class="field">{{ include_field.label_tag }}</td> <td class="field">{{ include_field.label_tag }}<br>{{ include_field.id }}</td>
<td class="include">{{ include_field }}</td> <td class="include">{{ include_field }}</td>
<td class="filter last">{{ filter_field }}</td> <td class="filter">{{ filter_field }}</td>
<td class="options last"> <td class="options">
<div class="options-div"> <div class="options-div">
{% for option_field in filter_option_fields %} {% for option_field in filter_option_fields %}
{{ option_field.label_tag }} {{ option_field }} {{ option_field.label_tag }} {{ option_field }}
{% endfor %} {% endfor %}
</div> </div>
</td> </td>
<td class="last">
<a href="{{ graphic_field.value }}" onclick="return showAddAnotherPopup(this);">{{ graphic_field.label }}</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
<tr class="{% cycle row %}"> <tr class="{% cycle row %}">
@ -110,7 +115,7 @@ $(function() {
<td class="include-all"> <td class="include-all">
<input type="checkbox" id="include-all" class="include-all" checked="checked"> <input type="checkbox" id="include-all" class="include-all" checked="checked">
</td> </td>
<td class="last" colspan="2">&nbsp;</td> <td class="last" colspan="3">&nbsp;</td>
</tr> </tr>
</table> </table>
<input type="submit" name="back" class="button" value="{% trans "Back to form" %}"> <input type="submit" name="back" class="button" value="{% trans "Back to form" %}">

28
sigi/apps/pesquisas/templates/pesquisas/chart.html

@ -0,0 +1,28 @@
<html xmlns="http://www.w3.org/1999/html">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script>
$(function () {
$('#chart').highcharts({
chart: {
type: 'pie'
},
title: {
text: 'Grafico'
},
series: [{
data: [
{% for serie in dados %}
['{{ serie.value }}', {{ serie.total }}],
{% endfor %}
]
}]
});
});
</script>
</head>
<body>
<div id="chart" style="width:100%; height:400px;"></div>
</body>
</html>

2
sigi/apps/pesquisas/views.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from sigi.forms_builder.forms.views import FormDetail, FormSent from forms_builder.forms.views import FormDetail, FormSent
from sigi.apps.pesquisas.models import Pesquisa from sigi.apps.pesquisas.models import Pesquisa
from sigi.apps.pesquisas.forms import PesquisaForm from sigi.apps.pesquisas.forms import PesquisaForm

2
sigi/urls.py

@ -18,6 +18,8 @@ urlpatterns = patterns('',
url(r'^servicos/', include('sigi.apps.servicos.urls')), url(r'^servicos/', include('sigi.apps.servicos.urls')),
url(r'^dashboard/', include('sigi.apps.metas.urls')), url(r'^dashboard/', include('sigi.apps.metas.urls')),
url(r'^pesquisas/formulario/', include('sigi.apps.pesquisas.urls')), url(r'^pesquisas/formulario/', include('sigi.apps.pesquisas.urls')),
url(r'^pesquisas/chart/(?P<field_id>\d+)/$', 'sigi.apps.pesquisas.views.chart_view'),
url(r'^', include(admin.site.urls)), url(r'^', include(admin.site.urls)),

Loading…
Cancel
Save