51 var tag = $(this).attr('data-tag'); |
45 var tag = $(this).attr('data-tag'); |
52 keywordsTagIt.tagit("createTag", tag); |
46 keywordsTagIt.tagit("createTag", tag); |
53 }); |
47 }); |
54 } |
48 } |
55 |
49 |
56 //map |
50 |
|
51 |
|
52 // add item to collection behaviour |
|
53 $('.additemtocollection').bind('click', function(e){ |
|
54 // When an item meant to be added to a collection is clicked, |
|
55 // we fill the form in the add-to-collection div |
|
56 console.log(this + ", " + $(this) + ", " + $(this).attr('data-type') + ", " + $(this).attr('data-id')); |
|
57 $('#add-to-collection .item-type').val($(this).attr('data-type')); |
|
58 $('#add-to-collection .item-id').val($(this).attr('data-id')); |
|
59 }); |
|
60 |
|
61 |
|
62 |
57 if($('#map').length){ |
63 if($('#map').length){ |
58 initmap() |
64 initmap() |
59 } |
65 } |
60 function initmap() { |
66 function initmap() { |
61 // set up the map |
67 // set up the map |
62 map = new L.Map('map'); |
68 map = new L.Map('map'); |
63 |
69 |
64 // create the tile layer with correct attribution |
70 // create the tile layer with correct attribution |
65 var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; |
71 var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; |
66 var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20}); |
72 var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20}); |
67 |
73 |
68 // start the map in South-East England |
74 // start the map in South-East England |
69 map.setView(new L.LatLng(48.833, 2.333),4); |
75 map.setView(new L.LatLng(48.833, 2.333),4); |
70 map.addLayer(osm); |
76 map.addLayer(osm); |
71 |
77 |
72 // markers |
78 // markers |
73 var marker1 = L.marker([48.833, 2.333]).addTo(map); |
79 var marker1 = L.marker([48.833, 2.333]).addTo(map); |
74 marker1.bindPopup("Beaux-Arts de Paris"); |
80 marker1.bindPopup("Beaux-Arts de Paris"); |
75 var marker2 = L.marker([47.233,-1.583]).addTo(map); |
81 var marker2 = L.marker([47.233,-1.583]).addTo(map); |
76 marker2.bindPopup("Beaux-Arts de Nantes"); |
82 marker2.bindPopup("Beaux-Arts de Nantes"); |
77 } |
83 } |
78 |
84 |
79 });//ready |
85 });//ready |