[Borges-users] Javascript

wilkes joiner wilkesjoiner at gmail.com
Thu Apr 29 14:30:40 EDT 2004


It turns out that the script method is not implemented on the
HtmlRenderer.  I got it to work by adding

To HtmlRenderer.rb
  def script(js)
    script_link(url_for_document(js, 'text/javascript'))
  end

and

To HtmlBuilder
  def script_link(url)
    @attributes[:src] = url
    @attributes[:type] = 'text/javascript'
    head_tag(:script)
  end

Seems to work in my simple page, but you're mileage may vary.

- Wilkes

On 26 Apr 2004 12:08:37 -0700, Eric Hodel <drbrain at segment7.net> wrote:
> 
> wilkes joiner (wilkesjoiner at gmail.com) wrote:
> 
> > Great work on Borges! ?I'm glad to see it in Ruby. ?Seaside has really
> > impressed me, but a Ruby version is more compelling to me.
> >
> > Is there an example of how to use Javascript in a component? ?I wasn't
> > able to turn up anything by browsing the code.
> 
> There's #script on Borges::Component which works just like #style.
> 
> In your component, define a script method that returns the JS as
> a String, and it will be attached as a <link> to your pages.
> 
> You can attach onclick and similar behaviors to elements with
> r.attributes[:onclick] = "js_here();"
> 
> > By the way, is there a wiki for Borges? ?It could be a good place to
> > store this kind of info. ?Maybe use the one on RubyGarden?
> 
> No, but one could be created on the RubyForge site, as I see some of the
> other projects have Wikis setup.
> 
> --
> Eric Hodel - drbrain at segment7.net - http://segment7.net
> All messages signed with fingerprint:
> FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04
> 
> 
>



More information about the Borges-users mailing list