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 -- Posted via http://www.ruby-forum.com/.
John Henderson 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''... -- Alex
Alex Young wrote:> John Henderson 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 -- Posted via http://www.ruby-forum.com/.
Nuno wrote:> Alex Young wrote: >> John Henderson 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 RubyOh 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 -- Posted via http://www.ruby-forum.com/.
Alex Young wrote:> John Henderson 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="<img src=''images/folder.gif'' width=''16'' height=''16'' hspace=''0'' vspace=''0'' border=''0''>"; } else { obj.style.display="block"; key.innerHTML="<img src=''images/textfolder.gif'' width=''16'' height=''16'' hspace=''0'' vspace=''0'' border=''0''>"; } } 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 -- Posted via http://www.ruby-forum.com/.
images shouls be referenced like src="/images" did you try that? On 4/19/06, John Henderson <john.henderson@mac.com> wrote:> > Alex Young wrote: > > John Henderson 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="<img src=''images/folder.gif'' width=''16'' height=''16'' > hspace=''0'' vspace=''0'' border=''0''>"; > } else { > obj.style.display="block"; > key.innerHTML="<img src=''images/textfolder.gif'' width=''16'' > height=''16'' hspace=''0'' vspace=''0'' border=''0''>"; > } > } > > > 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060418/9ab92e90/attachment.html