51 |
51 |
52 // add item to collection behaviour |
52 // add item to collection behaviour |
53 $('.additemtocollection').bind('click', function(e){ |
53 $('.additemtocollection').bind('click', function(e){ |
54 // When an item meant to be added to a collection is clicked, |
54 // When an item meant to be added to a collection is clicked, |
55 // we fill the form in the add-to-collection div |
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')); |
56 $('#add-to-collection .item-type').val($(this).attr('data-type')); |
58 $('#add-to-collection .item-id').val($(this).attr('data-id')); |
57 $('#add-to-collection .item-id').val($(this).attr('data-id')); |
59 }); |
58 }); |
60 |
59 |
61 |
60 |
|
61 $(".ajax-form").submit(function(e) { // On submit Ajax Form |
|
62 var formel = $(this); |
|
63 $.ajax({ |
|
64 url: formel.attr("action"), |
|
65 type: formel.attr("method"), |
|
66 data: formel.serialize(), |
|
67 success: function(text) { |
|
68 $('.popin-wrap').fadeIn(function(){ |
|
69 $(".additem-success").show(); |
|
70 }); |
|
71 //console.log("received : " + text); |
|
72 $(".additem-success .collection-url").attr("href", text); |
|
73 }, |
|
74 error: function() { |
|
75 $('.popin-wrap').fadeIn(function(){ |
|
76 $(".additem-error").show(); |
|
77 }); |
|
78 } |
|
79 }); |
|
80 formel.parents(".popin").hide(); |
|
81 return false; |
|
82 }); |
62 |
83 |
63 if($('#map').length){ |
84 if($('#map').length){ |
64 initmap() |
85 initmap() |
65 } |
86 } |
66 function initmap() { |
87 function initmap() { |