Browse Source

Melhorias na interface do mapa de atuação do Interlegis

stable/1.0
Sesostris Vieira 12 years ago
parent
commit
08b6349aa1
  1. 16
      media/js/metas/mapa.js
  2. 5
      sigi/templates/metas/mapa.html

16
media/js/metas/mapa.js

@ -5,6 +5,7 @@
$(document).ready(function($) { $(document).ready(function($) {
$("input[type='checkbox']").change( filter ); $("input[type='checkbox']").change( filter );
$("#changelist-search").submit( search ); $("#changelist-search").submit( search );
$("#closeiwlink").click( closeAllInfowindows );
var latlng = new google.maps.LatLng(-14.2350040, -51.925280); var latlng = new google.maps.LatLng(-14.2350040, -51.925280);
var myOptions = { var myOptions = {
zoom: 5, zoom: 5,
@ -40,7 +41,8 @@
var mark = new google.maps.Marker(markData); var mark = new google.maps.Marker(markData);
var infoWin = new google.maps.InfoWindow({content: '<strong>' + municipio.nome + '</strong><br/><br/>' + municipio.info }); var infoWin = new google.maps.InfoWindow({content: '<strong>' + municipio.nome + '</strong><br/><br/>' + municipio.info });
linkMarkMessage(mark, infoWin, map); linkMarkMessage(mark, infoWin, map);
municipio['mapmark'] = mark municipio['mapmark'] = mark;
municipio['infowindow'] = infoWin;
municipiosArray[i] = municipio; municipiosArray[i] = municipio;
} }
filter(null); filter(null);
@ -52,6 +54,12 @@
google.maps.event.addListener(mark, 'click', function() {infoWin.open(map, mark);}); google.maps.event.addListener(mark, 'click', function() {infoWin.open(map, mark);});
} }
function closeAllInfowindows() {
for (var i in municipiosArray) {
municipiosArray[i]['infowindow'].close();
}
}
function filter(event) { function filter(event) {
var data = $("#filter_form").serializeArray(); var data = $("#filter_form").serializeArray();
var estados = []; var estados = [];
@ -70,6 +78,7 @@
for (var i in municipiosArray) { for (var i in municipiosArray) {
var municipio = municipiosArray[i]; var municipio = municipiosArray[i];
municipio['infowindow'].close();
var aparece = false; var aparece = false;
if (regioes.indexOf(municipio.regiao) == -1 && estados.indexOf(municipio.estado) == -1) { if (regioes.indexOf(municipio.regiao) == -1 && estados.indexOf(municipio.estado) == -1) {
@ -99,7 +108,6 @@
} }
function search(event) { function search(event) {
var data =
$.ajax({ $.ajax({
url: "/sigi/dashboard/mapsearch/", url: "/sigi/dashboard/mapsearch/",
type: 'GET', type: 'GET',
@ -119,6 +127,9 @@
for (var i in return_data.ids) { for (var i in return_data.ids) {
var municipio = municipiosArray[return_data.ids[i]]; var municipio = municipiosArray[return_data.ids[i]];
if (typeof(municipio) != 'undefined') { if (typeof(municipio) != 'undefined') {
if (municipio.mapmark.map == null) {
municipio.mapmark.setMap(map);
}
google.maps.event.trigger(municipio.mapmark, 'click'); google.maps.event.trigger(municipio.mapmark, 'click');
total = total + 1; total = total + 1;
} }
@ -133,7 +144,6 @@
} else { } else {
$("#search-panel").html(total + ' municípios encontrados.'); $("#search-panel").html(total + ' municípios encontrados.');
} }
}}); }});
return false; return false;
} }

5
sigi/templates/metas/mapa.html

@ -25,6 +25,11 @@
<span id="search-panel" class="small quiet">&nbsp;</span> <span id="search-panel" class="small quiet">&nbsp;</span>
</div> </div>
</form> </form>
<ul class="object-tools">
<li>
<a href="#" id="closeiwlink">Fechar todas as janelas de informação</a>
</li>
</ul>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

Loading…
Cancel
Save