Class: Osmaps::MainController

Inherits:
Volt::ModelController
  • Object
show all
Defined in:
app/osmaps/controllers/main_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
# File 'app/osmaps/controllers/main_controller.rb', line 3

def index
end

#map(latitude, longitude, title) ⇒ Object



6
7
8
9
10
11
# File 'app/osmaps/controllers/main_controller.rb', line 6

def map(latitude, longitude, title)
  `var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});`
  `var map = L.map('osmaps').setView([latitude, longitude], 15).addLayer(osm);`
  `L.marker([ latitude, longitude]).addTo(map).bindPopup(title);`
  return nil
end