Eliminate templating from most javascript
This commit is contained in:
parent
2cb166cf33
commit
e256c837b5
7 changed files with 31 additions and 20 deletions
|
@ -22,8 +22,8 @@ OSM.Directions = function (map) {
|
|||
});
|
||||
|
||||
var endpoints = [
|
||||
Endpoint($("input[name='route_from']"), <%= asset_path('marker-green.png').to_json %>),
|
||||
Endpoint($("input[name='route_to']"), <%= asset_path('marker-red.png').to_json %>)
|
||||
Endpoint($("input[name='route_from']"), OSM.MARKER_GREEN),
|
||||
Endpoint($("input[name='route_to']"), OSM.MARKER_RED)
|
||||
];
|
||||
|
||||
function Endpoint(input, iconUrl) {
|
||||
|
@ -35,7 +35,7 @@ OSM.Directions = function (map) {
|
|||
iconSize: [25, 41],
|
||||
iconAnchor: [12, 41],
|
||||
popupAnchor: [1, -34],
|
||||
shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
|
||||
shadowUrl: OSM.MARKER_SHADOW,
|
||||
shadowSize: [41, 41]
|
||||
}),
|
||||
draggable: true
|
||||
|
@ -73,7 +73,7 @@ OSM.Directions = function (map) {
|
|||
|
||||
endpoint.awaitingGeocode = true;
|
||||
|
||||
$.getJSON(document.location.protocol + '<%= NOMINATIM_URL %>search?q=' + encodeURIComponent(endpoint.value) + '&format=json', function (json) {
|
||||
$.getJSON(document.location.protocol + OSM.NOMINATIM_URL + 'search?q=' + encodeURIComponent(endpoint.value) + '&format=json', function (json) {
|
||||
endpoint.awaitingGeocode = false;
|
||||
endpoint.hasGeocode = true;
|
||||
if (json.length == 0) {
|
|
@ -8,17 +8,17 @@ OSM.NewNote = function(map) {
|
|||
|
||||
var noteIcons = {
|
||||
"new": L.icon({
|
||||
iconUrl: "<%= image_path 'new_note_marker.png' %>",
|
||||
iconUrl: OSM.NEW_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
}),
|
||||
"open": L.icon({
|
||||
iconUrl: "<%= image_path 'open_note_marker.png' %>",
|
||||
iconUrl: OSM.OPEN_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
}),
|
||||
"closed": L.icon({
|
||||
iconUrl: "<%= image_path 'closed_note_marker.png' %>",
|
||||
iconUrl: OSM.CLOSED_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
})
|
|
@ -6,17 +6,17 @@ OSM.Note = function (map) {
|
|||
|
||||
var noteIcons = {
|
||||
"new": L.icon({
|
||||
iconUrl: "<%= image_path('new_note_marker.png') %>",
|
||||
iconUrl: OSM.NEW_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
}),
|
||||
"open": L.icon({
|
||||
iconUrl: "<%= image_path('open_note_marker.png') %>",
|
||||
iconUrl: OSM.OPEN_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
}),
|
||||
"closed": L.icon({
|
||||
iconUrl: "<%= image_path('closed_note_marker.png') %>",
|
||||
iconUrl: OSM.CLOSED_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
})
|
|
@ -4,17 +4,17 @@ function initializeNotes(map) {
|
|||
|
||||
var noteIcons = {
|
||||
"new": L.icon({
|
||||
iconUrl: "<%= image_path 'new_note_marker.png' %>",
|
||||
iconUrl: OSM.NEW_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
}),
|
||||
"open": L.icon({
|
||||
iconUrl: "<%= image_path 'open_note_marker.png' %>",
|
||||
iconUrl: OSM.OPEN_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
}),
|
||||
"closed": L.icon({
|
||||
iconUrl: "<%= image_path 'closed_note_marker.png' %>",
|
||||
iconUrl: OSM.CLOSED_NOTE_MARKER,
|
||||
iconSize: [25, 40],
|
||||
iconAnchor: [12, 40]
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue