I convert my old JS files into CoffeeScript, In my public controller I used this functions $(''#events a'').lightBox() $(document).ready -> $("#slider").easySlider auto: true, continuous: true they load inside application.js like this (function() { $(''#events a'').lightBox(); $(document).ready(function() { $("#slider").easySlider({ auto: true, continuous: true }); }); but it doesnt seems to work, also tried with an alert "hello" and doesnt work neither, what i''m doing wrong? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try $ -> $(''#events a'').lightBox() $("#slider").easySlider auto: true continuous: true There is an online js to coffeescript converter out there, I just can''t find the link right now too. On Fri, Jul 22, 2011 at 9:19 PM, Tomas R. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I convert my old JS files into CoffeeScript, In my public controller I > used this functions > > $(''#events a'').lightBox() > > $(document).ready -> > > $("#slider").easySlider > auto: true, > continuous: true > > they load inside application.js like this > > (function() { > $(''#events a'').lightBox(); > $(document).ready(function() { > $("#slider").easySlider({ > auto: true, > continuous: true > }); > }); > > but it doesnt seems to work, also tried with an alert "hello" and doesnt > work neither, what i''m doing wrong? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Jul 2011, at 08:01, Martin Wawrusch wrote:> Try > > $ -> > $(''#events a'').lightBox() > $("#slider").easySlider > auto: true > continuous: true > > There is an online js to coffeescript converter out there, I just > can''t find the link right now too.http://ricostacruz.com/js2coffee/ Hope this helps :-) Best regards Peter De Berdt -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> they load inside application.js like this > > (function() { > $(''#events a'').lightBox(); > $(document).ready(function() { > $("#slider").easySlider({ > auto: true, > continuous: true > }); > > });Isn''t .call(this) missing at the end? The function is not called at all, no wonder it doesnt work. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote in post #1012552:> On 23 Jul 2011, at 08:01, Martin Wawrusch wrote: > >> Try >> >> $ -> >> $(''#events a'').lightBox() >> $("#slider").easySlider >> auto: true >> continuous: true >> >> There is an online js to coffeescript converter out there, I just >> can''t find the link right now too. > > http://ricostacruz.com/js2coffee/ > > Hope this helps :-) > > Best regards > > Peter De Berdtthat''s not the problem, the functions are well done. otherwise an alert "hello" should work and i will get an error somewhere in the file. and yes, .call(this); is placed inside the file -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I found the problem, a jquery plugin isnt loading well. Uncaught TypeError: undefined is not a function but it was working after rails 3.1, is beeing loaded at the end of the file so it should be ok (bubblepopup plugin) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
the problem is that coffee creates this in a private scope, so any method from inside that scope can''t be called.. try window.testFunction: (param) -> alert param and testFunction2: (param) -> alert param and check ''compiled'' code of both the function with "window" prefix will be available globally, instead of the other one there''s a big difference between (after ''compiling'') (function () { var testFunction2 = function(param) { alert(param); } }(); and var testFunction = function(param) alert(param); } as for the first case, there''s no publicly exposed part of the first testFunction2 function. tom On Jul 23, 2011, at 17:47 , Tomas R. wrote:> Peter De Berdt wrote in post #1012552: >> On 23 Jul 2011, at 08:01, Martin Wawrusch wrote: >> >>> Try >>> >>> $ -> >>> $(''#events a'').lightBox() >>> $("#slider").easySlider >>> auto: true >>> continuous: true >>> >>> There is an online js to coffeescript converter out there, I just >>> can''t find the link right now too. >> >> http://ricostacruz.com/js2coffee/ >> >> Hope this helps :-) >> >> Best regards >> >> Peter De Berdt > > that''s not the problem, the functions are well done. otherwise an alert > "hello" should work and i will get an error somewhere in the file. > > and yes, .call(this); is placed inside the file > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.-- ==============================================================================Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz ============================================================================== -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.