Browse Source

Add thumbnail image in map infowin

producao
Sesostris Vieira 10 years ago
parent
commit
e78b46ac6d
  1. 5
      sigi/apps/metas/views.py
  2. 5
      sigi/settings/base.py
  3. 7
      sigiStatic/js/metas/mapa.js

5
sigi/apps/metas/views.py

@ -22,6 +22,8 @@ from sigi.apps.utils import to_ascii
from sigi.apps.financeiro.models import Desembolso
from sigi.apps.metas.templatetags.mapa_tags import descricao_servicos
from functools import reduce
from easy_thumbnails.templatetags.thumbnail import thumbnail_url
import time
JSON_FILE_NAME = os.path.join(MEDIA_ROOT, 'apps/metas/map_data.json')
@ -282,7 +284,6 @@ def gera_map_data_file(cronjob=False):
Caso cronjob seja True, retorna log de tempo gasto na geração ou a mensagem do erro
que impediu a gravação do arquivo.
'''
import time
start = time.time()
casas = {}
@ -296,6 +297,8 @@ def gera_map_data_file(cronjob=False):
casa = {
'nome': c.nome + ', ' + c.municipio.uf.sigla,
'icone': '/static/img/mapmarker.png',
'thumb': thumbnail_url(c.foto, 'small'),
'foto': (c.foto.url if c.foto else ''),
'lat': str(c.municipio.latitude),
'lng': str(c.municipio.longitude),
'estado': c.municipio.uf.sigla,

5
sigi/settings/base.py

@ -140,5 +140,10 @@ THUMBNAIL_PROCESSORS = (
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
THUMBNAIL_ALIASES = {
'': {
'small': {'size': (300, 225), 'crop': True,},
},
}
IMAGE_CROPPING_SIZE_WARNING = True
IMAGE_CROPPING_THUMB_SIZE = (800, 600)

7
sigiStatic/js/metas/mapa.js

@ -43,7 +43,12 @@
icon: '/static/img/mapmarker.png'
}
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 + '<br/><br/>' +
'<a href="' + municipio.foto + '" target="_blank">' +
'<img src="' + municipio.thumb + '">' +
'</a>' });
linkMarkMessage(mark, infoWin, map);
municipio['mapmark'] = mark;
municipio['infowindow'] = infoWin;

Loading…
Cancel
Save