Hi I am relatively new to ruby on rails. I want to use this javascript bundle: http://prototype-window.xilinus.com/index.html How would I call those functions in an rjs file? example: win = new Window(''window_id'', {title: "Sample", top:100, left:350}) win.getContent().innerHTML = "<h1>Hello world !!</h1>"; win.setDestroyOnClose(); win.showCenter(); Thanks -- Posted via http://www.ruby-forum.com/.
I think you would use page.call ''javascript_to_be_evaluated'' with your example I''m guessing something like this would work page.call("win = new Window(''window_id'', {title: \"Sample\", top:100, left:350})") etc...etc.. don''t for get to include the javascript library in your layout <%= include_javascript_tag "library_name_here" %> And of course, make sure it''s in your rails app javascript folder =) heres the docs on it: http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html -Brian On 6/30/06, User <exl2@cornell.edu> wrote:> > Hi > > I am relatively new to ruby on rails. I want to use this javascript > bundle: > http://prototype-window.xilinus.com/index.html > > How would I call those functions in an rjs file? > > example: > win = new Window(''window_id'', {title: "Sample", top:100, left:350}) > win.getContent().innerHTML = "<h1>Hello world !!</h1>"; > win.setDestroyOnClose(); > win.showCenter(); > > > Thanks > > -- > 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/20060630/a736c840/attachment.html
Woops, I mean <%= javascript_include_tag "library_name_here" %> On 6/30/06, Brian Chamberlain <blchamberlain@gmail.com> wrote:> > I think you would use page.call ''javascript_to_be_evaluated'' > > with your example I''m guessing something like this would work > page.call("win = new Window(''window_id'', {title: \"Sample\", top:100, > left:350})") > etc...etc.. > don''t for get to include the javascript library in your layout > <%= include_javascript_tag "library_name_here" %> > And of course, make sure it''s in your rails app javascript folder =) > > heres the docs on it: > http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html > > > -Brian > > > > On 6/30/06, User <exl2@cornell.edu> wrote: > > > > Hi > > > > I am relatively new to ruby on rails. I want to use this javascript > > bundle: > > http://prototype-window.xilinus.com/index.html > > > > How would I call those functions in an rjs file? > > > > example: > > win = new Window(''window_id'', {title: "Sample", top:100, left:350}) > > win.getContent().innerHTML = "<h1>Hello world !!</h1>"; > > win.setDestroyOnClose(); > > win.showCenter (); > > > > > > Thanks > > > > -- > > 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/20060630/1c06ba64/attachment-0001.html
Hi, THanks for the input, but that did not work. Does anyone know how to get this to work using rjs? thanks Brian Chamberlain wrote:> I think you would use page.call ''javascript_to_be_evaluated'' > > with your example I''m guessing something like this would work > page.call("win = new Window(''window_id'', {title: \"Sample\", top:100, > left:350})") > etc...etc.. > don''t for get to include the javascript library in your layout > <%= include_javascript_tag "library_name_here" %> > And of course, make sure it''s in your rails app javascript folder =) > > heres the docs on it: > http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html > > -Brian-- Posted via http://www.ruby-forum.com/.
On Monday, July 03, 2006, at 4:57 PM, User wrote:>Hi, > >THanks for the input, but that did not work. Does anyone know how to >get this to work using rjs? > >thanks > >Brian Chamberlain wrote: >> I think you would use page.call ''javascript_to_be_evaluated'' >> >> with your example I''m guessing something like this would work >> page.call("win = new Window(''window_id'', {title: \"Sample\", top:100, >> left:350})") >> etc...etc.. >> don''t for get to include the javascript library in your layout >> <%= include_javascript_tag "library_name_here" %> >> And of course, make sure it''s in your rails app javascript folder =) >> >> heres the docs on it: >> http://api.rubyonrails.com/classes/ActionView/Helpers/ >>PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html >> >> -Brian > > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsIn an RJS template, I think this outputs JS directly.. page << ''javascript code goes here'' _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
That does. and it does work, however, I would like to try it without dumping straight up javascript code because i could just do it in js instead. thanks Kevin Olbrich wrote:> On Monday, July 03, 2006, at 4:57 PM, User wrote: >>> with your example I''m guessing something like this would work >>> >>> -Brian >> >> >>-- >>Posted via http://www.ruby-forum.com/. >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails > > In an RJS template, I think this outputs JS directly.. > > page << ''javascript code goes here'' > > _Kevin-- Posted via http://www.ruby-forum.com/.
On Monday, July 03, 2006, at 6:22 PM, User wrote:>That does. and it does work, however, I would like to try it without >dumping straight up javascript code because i could just do it in js >instead. > >thanks > >Kevin Olbrich wrote: >> On Monday, July 03, 2006, at 4:57 PM, User wrote: >>>> with your example I''m guessing something like this would work >>>> >>>> -Brian >>> >>> >>>-- >>>Posted via http://www.ruby-forum.com/. >>>_______________________________________________ >>>Rails mailing list >>>Rails@lists.rubyonrails.org >>>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> In an RJS template, I think this outputs JS directly.. >> >> page << ''javascript code goes here'' >> >> _Kevin > > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsThe RJS functions like page.replace_html are all helper functions. You could write a set of helper functions like that for your JS library and then use them in a similar manner. _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.