thanks for the input. the help is appreciated.

On Nov 28, 10:49 pm, "Justin Dossey" <[EMAIL PROTECTED]> wrote:
> Yup, or even move the whole javascript block into a .js file and call=
> javascript_tag "write_signin_link('#{escape_javascript sign_in_url}')"
> from the haml.
>
>
>
> On Fri, Nov 28, 2008 at 8:05 AM, scottwb <[EMAIL PROTECTED]> wrote:
>
> > You can use #{} interpolation in the text under the :javascript
> > filter. So, for your example, you can do:
>
> > :javascript
> >  if (document.cookie.indexOf('signed_in') == -1) {
> >     document.write('<li class="first">#{link_to("Sign in", :controller
> > => "user", :action => "sign_in")}</li>');
> >  }
>
> > I would also suggest using a helper for the contents of your
> > document.write so that you could do something like this:
>
> > document.write('#{sign_in_link}');
>
> > Hope this helps.
> > -scottwb
>
> > rvr wrote:
> > > actually, i'm not trying to run haml and rails in the browser. i
> > > understand that the :javascript filter takes only plain text, so this
> > > won't work. but this kind of approach works in rhtml. the point is i
> > > want to be able to have a js block which haml still processes for haml
> > > tags. if there's no way to do it, fine. but it's not as strange as you
> > > seem to think.
>
> > > in rhtml i can do this:
>
> > > <script type="text/javascript>
> > >   if (document.cookie.indexOf('signed_in') == -1) {
> > >     document.write('<li class="first"><%= link_to("Sign
> > > In", :controller =>
> > > "user", :action => "sign_in")%></li>');
> > >   }
> > > </script>
>
> > > this is not trying to do rails in the browser, since rails processes
> > > this text and builds the link tag. guess this approach won't work in
> > > haml?
>
> > > On Nov 26, 1:13 pm, Evgeny <[EMAIL PROTECTED]> wrote:
> > > > You would need some kind of JavaScript-HAML library for that ... and
> > bundle
> > > > it with Ruby on Javascript as well, to handle the link_to methods you
> > are
> > > > trying to call.
> > > > This just does not make sense, you are trying to run HAML and Ruby on
> > Rails
> > > > in a user's browser.
>
> > > > Please, don't.
>
> > > > On Wed, Nov 26, 2008 at 18:35, rvr <[EMAIL PROTECTED]> wrote:
>
> > > > > how do i handle haml inside inline js so that it will get processed?
> > > > > this code works fine except that the markup inside the document.write
> > > > > statements is treated as plain text.
>
> > > > > :javascript
> > > > > if (document.cookie.indexOf('signed_in') == -1) {
> > > > > document.write('%li.first= link_to("Sign In", :controller =>
> > > > > "user", :action => "sign_in")');
> > > > > document.write('%li.last= link_to("Create
> > > > > Profile", :controller => "user", :action => "create")');
> > > > > } else {
> > > > > document.write('%li.first= link_to("My Account", :controller
> > > > > => "user", :action => "user")');
> > > > > document.write('%li.last= link_to("Sign Out", :controller =>
> > > > > "user", :action => "sign_out")');
> > > > > }
>
> > > > > any help is appreciated.
>
> --
> Justin Dossey
>
> --
> Justin Dossey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to