Bonjour,
Je suis en train de tester Jquery avec Rails, pour l'instant ça va à
peu près mais j'ai un problème avec du javascript (googlemaps) qui
fonctionnait avec et qui ne fonctionne plus maintenant.
mon application.js est comme suit (pas besoin de tout lire, la partie
dans $(function) marche ;)
$(function() {
var delete_url = "";
$("#dialog-confirm-delete").dialog({
resizable: false,
height:140,
modal: true,
autoOpen: false,
title: 'Suppression d\'un élément',
buttons: {
Oui: function() {
$('<form method="post" action="' + delete_url + '" /
>')
.append('<input type="hidden" name="_method"
value="delete" />')
.append('<input type="hidden"
name="authenticity_token" value="' + auth_token + '" />')
.appendTo('body')
.submit();
$(this).dialog('close');
},
Non: function() {
$(this).dialog('close');
}
}
});
$(".delete").click(function() {
delete_url = $(this).attr("href");
$("#dialog-confirm-delete").dialog('open');
return false;
});
// Cluetip
$('input.tooltip').cluetip({splitTitle: '|', arrows: true});
// prettyPhoto
www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentation/
$("a[rel^='prettyPhoto']").prettyPhoto({
theme: 'facebook',
autoplay: true
});
});
LocationMap = new Class.create({
initialize: function(map, location, zoom) {
this.element = $(map);
this.location = location.evalJSON();
this.zoom = zoom
document.observe("dom:loaded", this.init.bind(this));
},
init: function() {
if (GBrowserIsCompatible()) {
// Create a google map
this.map = new GMap2(this.element);
// Add controls
this.map.addControl(new GLargeMapControl());
this.map.addControl(new GMapTypeControl());
// Center on location
this.map.setCenter(new GLatLng(this.location.location.lat,
this.location.location.lng), this.zoom);
// this.map.setCenter(new GLatLng(48.8640722000,
2.3677068000), 15);
var marker = new GMarker(new GLatLng
(this.location.location.lat, this.location.location.lng));
this.map.addOverlay(marker);
}
}
});
et dans ma vue j'ai
<%= javascript_tag "new LocationMap('map','#{@location.to_json(:only
=> [:name, :lat, :lng])}',#{@zoom});" %>
J'obtiens l'erreur
LocationMap is not defined
new LocationMap('map','{"location": {"...7111702, "lat":
48.6850566941}}',16);
A noter que j'ai installé le jrail plugin et que j'ai essayé de
remonter le LocationMap dans le $(function) mais sans succès.
Merci de m'avoir lu jusqu'ici, merci de votre aide.
on 2010-02-01 16:15
on 2010-02-01 17:55
En y réfléchissant, la raison est sans doute parce que que mon code pour google maps est basé sur le frameworks prototype. Je vais regarder comment le transformer mais si quelqu'un a une idéerapide, je suis preneur Nicolas
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.