Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render and parse problems when using with <script/> templates #98

Closed
stackus opened this issue May 31, 2011 · 4 comments
Closed

Render and parse problems when using with <script/> templates #98

stackus opened this issue May 31, 2011 · 4 comments

Comments

@stackus
Copy link

stackus commented May 31, 2011

When a validated form is put into a <script/> template the extra <script> var ... {...}; </script> closes the original script tag early.

Example:

%script{:type => "text/html"}
  = form_for Person.new :validate => true do |f|
    = f.text_field :name

What is finally rendered is a script tag surrounding another script tag. Could the gem be changed to allow the user to choose to have the script contents be sent to content_for and the symbol of their choosing?

@bcardarella
Copy link
Contributor

That's an interesting proposal. I'm not opposed to this but I'm not certain how the API would look. Maybe something like this:

= form_for @person, :validate => :person do |f|
  = f.text_field :name

The idea is to pass something other than true. If that is the case then the user would have to manually do:

= content_for :person

Thoughts?

@stackus
Copy link
Author

stackus commented May 31, 2011

After posting the issue I wanted to see if what I asked was possible so I got into the gem source and monkey patched in some code and that's what I ended up doing.

@bcardarella
Copy link
Contributor

Ok, I think API I proposed makes sense. I'll add it. Thanks for the feed back :)

@bcardarella
Copy link
Contributor

There you go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants