Lightbox2 javascript file behavior different on web server and localhost ?

80 views
Skip to first unread message

Erwin

unread,
Sep 1, 2008, 1:02:11 PM9/1/08
to Ruby on Rails: Talk
I am running locally and using Lightbox2 ( http://www.lokeshdhakar.com/projects/lightbox2/)
to open a picture from a thumbnail

see site : http://www.ceramique-isabelle.fr (see ceramiques, click
thumbnail, then click the left picture)

in my layout I wrote this line to load the js in sequence as stated by
lightbox2
<%= javascript_include_tag 'prototype', 'scriptaculous', 'lightbox',
'widgEditor', 'application', :cache => true %>

and the lightbox link is :
<a href="<%= big_image_link(@c, @p) %>" rel="lightbox"
title="agrandissement">
<%= image_tag( left_box_image(@c, @p), :size =>
@left_image_size, :border => 0, :id => 'imageLeft') -%>
</a>
with a helper to build the link according to the clicked image
big_image_link(c, p)
return "#{WWW_HOST}/images/#{params[:controller]}/big/
#{params[:controller][0,1]}" + c.to_s + "d" + p.to_s + '.jpg'

so locally I get : <a href="http://localhost:3000/images/aquarelles/
big/a1d0.jpg" ..
and the image displays into the lightbox.

I can even use a link to my web server, and running locally , the
image displays too... !
<a href="http://www.ceramique-isabelle.fr/images/aquarelles/big/
a1d0.jpg" ..

but when running from the web server, the image doesn't display, I get
a js error :
Error : Builder is not defined
Source file : http://www.ceramique-isabelle.fr/javascripts/all.js?1220286151
LIne : 4417

then (which seems normal to get this 2 error after the first.. )
Error : $("overlay") is null
Source file : http://www.ceramique-isabelle.fr/javascripts/all.js?1220286151
Line : 4494

what could be different between my web server and my local server ...
(same Rails level... 2.1)

Frederick Cheung

unread,
Sep 1, 2008, 1:54:03 PM9/1/08
to rubyonra...@googlegroups.com

On 1 Sep 2008, at 18:02, Erwin wrote:

>
> I am running locally and using Lightbox2 ( http://www.lokeshdhakar.com/projects/lightbox2/)
> to open a picture from a thumbnail

Does it work when running in production mode locally ?

Fred

Erwin

unread,
Sep 1, 2008, 3:02:55 PM9/1/08
to Ruby on Rails: Talk
yes, at least I hope so... (never run in production mode
locally ..... just RAILS_ENV=production in the console ?...)

the javascript error is actually Builder not loaded....
in the scriptaculous file :

(includes ? includes[1] :
'builder,effects,dragdrop,controls,slider,sound').split(',').each(
function(include) { Scriptaculous.require(path+include
+'.js') });

I am quite sure it's a js file loading problem.... not a Rail
problem,
but what could be the difference between being local dev and remote
production .... ???

I modified the header..

<script type="text/javascript" src="javascripts/prototype.js"></
script>
<script type="text/javascript" src="javascripts/scriptaculous.js?
load=effects,builder"></script>
<script type="text/javascript" src="javascripts/lightbox.js"></
script>
<script type="text/javascript" src="javascripts/widgEditor.js"></
script>
<script type="text/javascript" src="javascripts/application.js"></
script>

still running fine locally .. but same problem on web server (crashed
one hour ago... not my fault...°



On 1 sep, 19:54, Frederick Cheung <frederick.che...@gmail.com> wrote:
> On 1 Sep 2008, at 18:02, Erwin wrote:
>
>
>
> > I am running locally and using Lightbox2   (http://www.lokeshdhakar.com/projects/lightbox2/)

Frederick Cheung

unread,
Sep 1, 2008, 3:09:02 PM9/1/08
to Ruby on Rails: Talk


On Sep 1, 8:02 pm, Erwin <yves_duf...@mac.com> wrote:
> yes,  at least I hope so... (never run in production mode
> locally .....  just RAILS_ENV=production in the console ?...)
>
> the javascript error is actually  Builder not loaded....
> in the scriptaculous file :
>
> (includes ? includes[1] :
> 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
>        function(include) { Scriptaculous.require(path+include
> +'.js') });
>
> I am quite sure it's a js file loading problem.... not a Rail
> problem,
> but what could be the difference between being local dev and remote
> production .... ???
>
Because in production mode those files are cached and combined into
one, but not in dev mode

Fred

Erwin

unread,
Sep 2, 2008, 6:15:10 AM9/2/08
to Ruby on Rails: Talk
OK, I solved it testing direct links to js file ...

<script type="text/javascript" src="javascripts/prototype.js"></
script>
<script type="text/javascript" src="javascripts/effects.js"></script>
<script type="text/javascript" src="javascripts/builder.js"></script>
<script type="text/javascript" src="javascripts/lightbox.js"></
script>

solved it..... not loading the scriptaculous.js file did the
trick.....

thanks for your help..


On 1 sep, 21:09, Frederick Cheung <frederick.che...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages