Show geocoords for known locations.
This commit is contained in:
parent
d443179701
commit
df74c9f263
4 changed files with 61 additions and 44 deletions
|
@ -35,6 +35,9 @@ form .ui.form {
|
||||||
.attached-label > input, .attached-label > textarea {
|
.attached-label > input, .attached-label > textarea {
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
.attached-geo-label > input, .attached-geo-label > textarea {
|
||||||
|
margin-bottom: 3.2rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,15 +42,24 @@ $(document).ready(function () {
|
||||||
var coords = marker.getLatLng();
|
var coords = marker.getLatLng();
|
||||||
$('input[name=location_lat]').val(coords.lat);
|
$('input[name=location_lat]').val(coords.lat);
|
||||||
$('input[name=location_lon]').val(coords.lng);
|
$('input[name=location_lon]').val(coords.lng);
|
||||||
$('input[name=location]').css('margin-bottom','3.2rem');
|
$('input[name=location]').css('margin-bottom', '3.2rem');
|
||||||
$('span.coords').text('Folgende Koordinaten sind angegeben: lat:' +coords.lat + ', lon:' + coords.lng);
|
$('span.coords').text('Folgende Koordinaten sind angegeben: lat:' + coords.lat + ', lon:' + coords.lng);
|
||||||
},
|
},
|
||||||
onDeny: function () {
|
onDeny: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
onVisible: function () {
|
onVisible: function () {
|
||||||
map.invalidateSize(true);
|
map.invalidateSize(true);
|
||||||
|
var lat = parseFloat($('input[name=location_lat]').val());
|
||||||
|
var lon = parseFloat($('input[name=location_lon]').val());
|
||||||
|
if ((lat > 0) && (lon > 0)) {
|
||||||
|
map.setView([lat,lon],16);
|
||||||
|
var latlng = new L.LatLng(lat,lon);
|
||||||
|
marker.setLatLng(latlng);
|
||||||
|
marker.addTo(map);
|
||||||
|
} else {
|
||||||
map.locate({setView: true});
|
map.locate({setView: true});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).modal('attach events', '.add_geo', 'show');
|
}).modal('attach events', '.add_geo', 'show');
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{% stylesheets filter="compass"
|
{% stylesheets filter="compass"
|
||||||
"@CalciferBundle/Resources/assets/css/jquery.datetimepicker.scss" %}
|
"@CalciferBundle/Resources/assets/css/jquery.datetimepicker.scss"
|
||||||
|
"@CalciferBundle/Resources/assets/css/events.scss"
|
||||||
|
"@CalciferBundle/Resources/assets/css/leaflet.scss"
|
||||||
|
%}
|
||||||
<link rel="stylesheet" href="{{ asset_url }}"/>
|
<link rel="stylesheet" href="{{ asset_url }}"/>
|
||||||
{% endstylesheets %}
|
{% endstylesheets %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -10,7 +13,9 @@
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
{% javascripts
|
{% javascripts
|
||||||
"@CalciferBundle/Resources/assets/js/jquery.datetimepicker.js"
|
"@CalciferBundle/Resources/assets/js/jquery.datetimepicker.js"
|
||||||
"@CalciferBundle/Resources/assets/js/events.js" %}
|
"@CalciferBundle/Resources/assets/js/events.js"
|
||||||
|
"@CalciferBundle/Resources/assets/js/leaflet.js"
|
||||||
|
%}
|
||||||
<script src="{{ asset_url }}"></script>
|
<script src="{{ asset_url }}"></script>
|
||||||
{% endjavascripts %}
|
{% endjavascripts %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -77,19 +77,19 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="control-label required" for="event_location">Ort</label>
|
<label class="control-label required" for="event_location">Ort</label>
|
||||||
|
|
||||||
<div class="ui left labeled icon input attached-label">
|
<div class="ui left labeled icon input attached-{% if entity.location.lat|default(0) > 0 %}geo-{% endif %}label">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
id="event_location"
|
id="event_location"
|
||||||
name="location"
|
name="location"
|
||||||
maxlength="255"
|
maxlength="255"
|
||||||
value="{{ entity.location.name|default('') }}"
|
value="{{ entity.location.name|default('') }}"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
<input type="hidden" name="location_lat">
|
<input type="hidden" name="location_lat" value="{{ entity.location.lat|default('') }}">
|
||||||
<input type="hidden" name="location_lon">
|
<input type="hidden" name="location_lon" value="{{ entity.location.lon|default('') }}">
|
||||||
<i class="icon map marker"></i>
|
<i class="icon map marker"></i>
|
||||||
<div class="ui bottom attached label">
|
<div class="ui bottom attached label">
|
||||||
Du kannst zu diesem Ort auch Geokoordinaten <a href="#" class="add_geo">hinterlegen</a>.<br />
|
Du kannst zu diesem Ort auch Geokoordinaten <a href="#" class="add_geo">hinterlegen</a>.<br />
|
||||||
<span class="coords"></span>
|
<span class="coords">{% if entity.location.lat|default(0) > 0 %}Folgende Koordinaten sind angegeben: lat:{{ entity.location.lat }}, lon:{{ entity.location.lon }}{% endif %}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui modal geo chooser">
|
<div class="ui modal geo chooser">
|
||||||
<i class="close icon"></i>
|
<i class="close icon"></i>
|
||||||
|
|
Reference in a new issue