Pull down menus / Nested Javascripts


#1

Has anyone implemented a tab bar with pull down menus in RoR?
I’ve tried various javascript solutions but they all fail once you try
to call them from ruby.
Any pointers gratefuly received…
Cheers

John


#2

John H. wrote:

Has anyone implemented a tab bar with pull down menus in RoR?
I’ve tried various javascript solutions but they all fail once you try
to call them from ruby.
Any pointers gratefuly received…
Some failing code would be really useful here. Since a tab bar in Rails
would be Javascript underneath, it should be possible to make an
existing system work. It’s also not exactly clear what you mean by
‘call them from ruby’…


#3

Alex Y. wrote:

John H. wrote:

Has anyone implemented a tab bar with pull down menus in RoR?
I’ve tried various javascript solutions but they all fail once you try
to call them from ruby.
Any pointers gratefuly received…
Some failing code would be really useful here. Since a tab bar in Rails
would be Javascript underneath, it should be possible to make an
existing system work. It’s also not exactly clear what you mean by
‘call them from ruby’…

You might have a look here : http://script.spinelz.org/

The menubar is really easy to integrate in Ruby


#4

Nuno wrote:

Alex Y. wrote:

John H. wrote:

Has anyone implemented a tab bar with pull down menus in RoR?
I’ve tried various javascript solutions but they all fail once you try
to call them from ruby.
Any pointers gratefuly received…
Some failing code would be really useful here. Since a tab bar in Rails
would be Javascript underneath, it should be possible to make an
existing system work. It’s also not exactly clear what you mean by
‘call them from ruby’…

You might have a look here : http://script.spinelz.org/

The menubar is really easy to integrate in Ruby

Oh super! This stuff looks fab. Can’t wait to get home tonight to try
it out. I see there’s all sorts of other good stuff there too like nav
bars, treeviews etc. I’ll let you know how I get on. Thanks
John


#5

Alex Y. wrote:

John H. wrote:

Has anyone implemented a tab bar with pull down menus in RoR?
I’ve tried various javascript solutions but they all fail once you try
to call them from ruby.
Any pointers gratefuly received…
Some failing code would be really useful here. Since a tab bar in Rails
would be Javascript underneath, it should be possible to make an
existing system work. It’s also not exactly clear what you mean by
‘call them from ruby’…

i seem to be narrowing the problem a bit… maybe the question now
should be ‘how do you reference an image file from within a javascript
in your ruby project assuming all images are in public/images?’

in the relevant component’s view list.rhtml

<script language="javascript" src="javascripts/tree.js"></script>

tree.js contains:

function Toggle(item) {
obj=document.getElementById(item);
visible=(obj.style.display!=“none”)
key=document.getElementById(“x” + item);
if (visible) {
obj.style.display=“none”;
key.innerHTML="";
} else {
obj.style.display=“block”;
key.innerHTML="";
}
}

all works ok except the image wont be loaded. I’ve tried all sorts of
different folder/path settings, even specifying the full pathname to the
image file and still it wont load.

it looks like when Ruby is rendering a .rhtml file, it can call a
javascript however the javascript cannot c reference any other files -
unless I’m missing something (which obviously I am and which is the
answer to the question!)

i’ve found the same thing happening if you call javascript “script1.js”,
if it wants to call “script2.js” it seems to get lost and can’t find it.

John


#6

images shouls be referenced like src="/images"

did you try that?