Fix some validation issues

This commit is contained in:
Tom Hughes 2015-03-16 20:48:55 +00:00
parent d73a4efef0
commit 05caad1a5d
4 changed files with 10 additions and 6 deletions

View file

@ -303,7 +303,7 @@ OSM.Directions = function (map) {
$(".routing_marker").on('dragstart', function (e) {
e.originalEvent.dataTransfer.effectAllowed = 'move';
e.originalEvent.dataTransfer.setData('id', this.id);
e.originalEvent.dataTransfer.setData('type', $(this).data('type'));
var img = $("<img>").attr("src", $(e.originalEvent.target).attr("src"));
e.originalEvent.dataTransfer.setDragImage(img.get(0), 12, 21);
});
@ -321,11 +321,11 @@ OSM.Directions = function (map) {
$("#map").on('drop', function (e) {
e.preventDefault();
var oe = e.originalEvent;
var id = oe.dataTransfer.getData('id');
var type = oe.dataTransfer.getData('type');
var pt = L.DomEvent.getMousePosition(oe, map.getContainer()); // co-ordinates of the mouse pointer at present
pt.y += 20;
var ll = map.containerPointToLatLng(pt);
endpoints[id === 'marker_from' ? 0 : 1].setLatLng(ll);
endpoints[type === 'from' ? 0 : 1].setLatLng(ll);
getRoute();
});

View file

@ -783,6 +783,10 @@ nav.secondary {
#attribution {
display: none;
table {
width: 100%
}
}
.attribution_license,

View file

@ -12,11 +12,11 @@
<div class="header"><span class="icon close"></span></div>
<div class="line">
<%= image_tag "marker-green.png", :class => "routing_marker", :id => "marker_from", :draggable => "true" %>
<%= image_tag "marker-green.png", :class => "routing_marker", :data => { :type => "from" }, :draggable => "true" %>
<span class="force_width"><%= text_field_tag "route_from", params[:from], :placeholder => t('site.search.from') %></span>
</div>
<div class="line">
<%= image_tag "marker-red.png", :class => "routing_marker", :id => "marker_to", :draggable => "true" %>
<%= image_tag "marker-red.png", :class => "routing_marker", :data => { :type => "to" }, :draggable => "true" %>
<span class="force_width"><%= text_field_tag "route_to" , params[:to] , :placeholder => t('site.search.to') %></span>
</div>
<div class="line">

View file

@ -68,7 +68,7 @@
</div>
<div id="attribution">
<table width="100%">
<table>
<tr>
<td class="attribution_license"><%= t 'site.index.license.license_url' %></td>
<td class="attribution_project"><%= t 'site.index.license.project_url' %></td>