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

Whitespace in inserted textareas #323

Closed
jmuheim opened this issue Oct 16, 2015 · 5 comments
Closed

Whitespace in inserted textareas #323

jmuheim opened this issue Oct 16, 2015 · 5 comments

Comments

@jmuheim
Copy link

jmuheim commented Oct 16, 2015

There's always some whitespace in textareas that were inserted using cocoon. How can I prevent this?

<textarea class="text optional form-control pastable" placeholder="asdf" name="boilerplate[findings_attributes][1444981219987][screenshot]" id="boilerplate_findings_attributes_1444981219987_screenshot">    </textarea>
@nathanvda
Copy link
Owner

I am assuming you are using haml? Check this: http://haml.info/docs/yardoc/file.FAQ.html#q-preserve

@arta
Copy link

arta commented Nov 29, 2016

Thanks, but how can the Haml::Helpers#find_and_preserve help with dynamically generated nested textareas (differentiated with some sort of dynamically generated child_index)?

@nathanvda
Copy link
Owner

Are you asking me for a technical explanation why it works, or are you stating that it does not help in your case? In that case it is maybe best to open a new issue?

Please note that the view is render server-side (only once), so it is unclear to me what you mean when you say "differentiated with a dynamically generated child-index", so imho you will be using javascript/callbacks to add that index, and in that case haml is no longer responsible for the added whitspace imho?

@arta
Copy link

arta commented Nov 29, 2016

I may be confused, but It seems to me that Haml::Helpers#find_and_preserve is not a solution to the issue #323. Hence my question. Thanks.

@arta
Copy link

arta commented Nov 29, 2016

Haml::Template.options[:ugly] = true or Haml::Template.options[:remove_whitespace] = true in config/initializers/haml.rb fixes it.

See haml/haml#643.

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

3 participants