Le preview présente mieux la carte OSM

This commit is contained in:
echarp 2014-08-25 11:12:22 +02:00
parent 4471ffd215
commit 2c784f0367
3 changed files with 9 additions and 2 deletions

View File

@ -15,7 +15,7 @@ $(document).ready ->
).addTo map
$('.events #map').each ->
$('.events #map, .moderations #map').each ->
coord = [$(this).attr('latitude'), $(this).attr('longitude')]
map = L.map('map').setView [coord[0], coord[1]], 16

View File

@ -8,5 +8,5 @@
.maps #map
height: 60em
.events #map
.events #map, .moderations #map
height: 20em

View File

@ -57,6 +57,13 @@ class Event < ActiveRecord::Base
self.submitter = contact if submitter.empty?
end
before_validation on: :update do
if address_changed?
self.latitude = nil
self.longitude = nil
end
end
before_create do
self.secret = SecureRandom.urlsafe_base64(32)[0...32]
self.moderator_mail_id = SecureRandom.urlsafe_base64(32)[0...32]