integration/v2/js/main.js
changeset 188 aa163c5df6e3
parent 187 be4eb4db3418
parent 185 5f265e870a8d
child 219 6667fb5455d0
--- a/integration/v2/js/main.js	Thu Jun 27 17:31:15 2013 +0200
+++ b/integration/v2/js/main.js	Thu Jun 27 17:38:53 2013 +0200
@@ -1,11 +1,5 @@
 $(function(){
-//filters
-	$('.filters a').each(function(){
-		var text = $.trim($(this).text());
-		if(text.length > 26){
-			$(this).text(text.substr(0, 26) + '...')
-		}
-	});
+
 //masonry
 	var masonry465 = $('.masonry-465');
 	masonry465.masonry({
@@ -53,27 +47,39 @@
 		});
 	}
 
-//map
+
+	
+	// add item to collection behaviour
+	$('.additemtocollection').bind('click', function(e){
+		// When an item meant to be added to a collection is clicked,
+		// we fill the form in the add-to-collection div
+		console.log(this + ", " + $(this) + ", " + $(this).attr('data-type') + ", " + $(this).attr('data-id'));
+		$('#add-to-collection .item-type').val($(this).attr('data-type'));
+		$('#add-to-collection .item-id').val($(this).attr('data-id'));
+	});
+	
+	
+
 	if($('#map').length){
 		initmap()
 	}
-function initmap() {
-	// set up the map
-	map = new L.Map('map');
+	function initmap() {
+		// set up the map
+		map = new L.Map('map');
 
-	// create the tile layer with correct attribution
-	var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
-	var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20});		
+		// create the tile layer with correct attribution
+		var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
+		var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20});		
 
-	// start the map in South-East England
-	map.setView(new L.LatLng(48.833, 2.333),4);
-	map.addLayer(osm);
+		// start the map in South-East England
+		map.setView(new L.LatLng(48.833, 2.333),4);
+		map.addLayer(osm);
 
-	// markers
-	var marker1 = L.marker([48.833, 2.333]).addTo(map);
-	marker1.bindPopup("Beaux-Arts de Paris");
-	var marker2 = L.marker([47.233,-1.583]).addTo(map);
-	marker2.bindPopup("Beaux-Arts de Nantes");
-}
+		// markers
+		var marker1 = L.marker([48.833, 2.333]).addTo(map);
+		marker1.bindPopup("Beaux-Arts de Paris");
+		var marker2 = L.marker([47.233,-1.583]).addTo(map);
+		marker2.bindPopup("Beaux-Arts de Nantes");
+	}
 
-});//ready
+});//ready
\ No newline at end of file