Why would you use haml to generate js? Haml is for generating markup. If the
entire file is made up of javascript then use erb, for sure.
chris

On Tue, Aug 4, 2009 at 4:40 PM, Noel <[email protected]> wrote:

>
> like this?
>
> :javascript
>  alert("testing");
>
> That's all in the view and no alert shows up
>
> with this in an erb file (just renamed from .js.haml to .js.erb)  alert
> appears
>
> alert("testing");
>
> -Noel
>
>
> On Mon, Aug 3, 2009 at 10:39 PM, Nathan Weizenbaum<[email protected]>
> wrote:
> > The colon goes before the word "javascript".
> >
> > On Mon, Aug 3, 2009 at 4:43 PM, Noel <[email protected]> wrote:
> >>
> >> yes, I am using 2 spaces (this is the entire view)
> >>
> >> javascript:
> >>  alert(#...@user_session.errors.full_messages.join("\n").to_json});
> >>
> >> that gives the (Illegal nesting: nesting within plain text is
> >> illegal.)  error, but if I do
> >>
> >> javascript:
> >> alert(#...@user_session.errors.full_messages.join("\n").to_json});
> >>
> >> it works, but then you can't indent within the JS code
> >>
> >>
> >>
> >> On Mon, Aug 3, 2009 at 4:34 PM, G. Sobrinho<[email protected]>
> >> wrote:
> >> > Please, post your view here: www.pastie.org
> >> > This error is a indentation error. Are you using 2 spaces? (no tabs)
> >> >
> >> > 2009/8/3 Noel <[email protected]>
> >> >>
> >> >> tried
> >> >>
> >> >> javascript:
> >> >>  alert(#...@user_session.errors.full_messages.join("\n").to_json});
> >> >>
> >> >> did not work, no alert, but then I thought of looking in the terminal
> >> >> and noticed an error.
> >> >>
> >> >> ActionView::TemplateError (Illegal nesting: nesting within plain text
> >> >> is illegal.) on line #2...
> >> >>
> >> >> So it looks like that was the problem.
> >> >>
> >> >> Thanks,
> >> >> Noel
> >> >>
> >> >> On Mon, Aug 3, 2009 at 4:23 PM, G. Sobrinho<
> [email protected]>
> >> >> wrote:
> >> >> > You can use
> >> >> > :javascript
> >> >> >   alert(#...@user_session.errors.full_messages.join("\n").to_json});
> >> >> >
> >> >> > 2009/8/3 Noel <[email protected]>
> >> >> >>
> >> >> >> In erb I can do
> >> >> >>
> >> >> >> alert("<%= @user_session.errors.full_messages %>");
> >> >> >>
> >> >> >> How would I do this in HAML
> >> >> >>
> >> >> >> I tried
> >> >> >>
> >> >> >> javascript:
> >> >> >>  alert(" @user_session.errors.full_messages ");
> >> >> >>
> >> >> >> even if I try this it doesn't work.
> >> >> >> javascript:
> >> >> >>  alert("hello");
> >> >> >>
> >> >> >> BTW, I am returning this to an AJAX call via a respond_to block.
> >> >> >>
> >> >> >> What am I doing wrong?
> >> >> >>
> >> >> >> -Noel
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Regards,
> >> >> >
> >> >> > Gabriel Sobrinho
> >> >> > +55 31 8775 8378
> >> >> >
> >> >> > >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Regards,
> >> >
> >> > Gabriel Sobrinho
> >> > +55 31 8775 8378
> >> >
> >> > >
> >> >
> >>
> >>
> >
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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