prop_up 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -221
- data/lib/prop/app_builder.rb +45 -28
- data/lib/prop/generators/app_generator.rb +40 -1
- data/lib/prop/version.rb +1 -1
- data/prop.gemspec +1 -0
- data/templates/Gemfile_clean +3 -0
- data/templates/application.js +9 -0
- data/templates/backbone.js +1586 -0
- data/templates/leaflet_map.js +50 -0
- data/templates/modernizr.js +834 -0
- data/templates/places.coffee +6 -0
- data/templates/prop_layout.html.erb.erb +20 -6
- data/templates/underscore.js +1282 -0
- metadata +22 -2
@@ -0,0 +1,50 @@
|
|
1
|
+
$(document).ready(function(){
|
2
|
+
if ($('#leaflet-map').length > 0) {
|
3
|
+
var latitude = 25.2000;
|
4
|
+
var longitude = 55.3000;
|
5
|
+
|
6
|
+
var map = L.map('leaflet-map').setView([25.2000, 55.3000], 11);
|
7
|
+
|
8
|
+
L.tileLayer('http://{s}.tile.cloudmade.com/CLOUDMADE_API_KEY_GOES_HERE/997/256/{z}/{x}/{y}.png', {
|
9
|
+
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
|
10
|
+
maxZoom: 18
|
11
|
+
}).addTo(map);
|
12
|
+
|
13
|
+
// add a marker in the given location, attach some popup content to it and open the popup
|
14
|
+
var marker;
|
15
|
+
|
16
|
+
marker = L.marker([25.2000, 55.3000]);
|
17
|
+
|
18
|
+
marker.addTo(map).bindPopup('Drag Me!').openPopup();
|
19
|
+
|
20
|
+
// This enables a draggable/droppable pin
|
21
|
+
|
22
|
+
marker.dragging.enable();
|
23
|
+
|
24
|
+
marker.on('dragend', function(e){
|
25
|
+
// do stuff
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
$('#places').on( 'submit', function(e) {
|
30
|
+
e.preventDefault();
|
31
|
+
// var query = $('#places').val()
|
32
|
+
// $.ajax({
|
33
|
+
// url: '/search_query',
|
34
|
+
// type: 'POST',
|
35
|
+
// data: { query: query }
|
36
|
+
// }).done(function(data){
|
37
|
+
// var locLatitude = parseFloat(data.latitude);
|
38
|
+
// var locLongitude = parseFloat(data.longitude);
|
39
|
+
// map.removeLayer(marker);
|
40
|
+
// map.setView([locLatitude, locLongitude], 11);
|
41
|
+
// marker = L.marker([locLatitude, locLongitude]);
|
42
|
+
// marker.addTo(map);
|
43
|
+
// marker.dragging.enable();
|
44
|
+
|
45
|
+
// marker.on('dragend', function(e){
|
46
|
+
// do stuff
|
47
|
+
// });
|
48
|
+
});
|
49
|
+
});
|
50
|
+
});
|