Closed adusak closed 8 years ago
WiceGrid view code is just helpers. Functions with blocks. Why intermingle this with Slim or HAML at all? It's an artificially created problem. The suggested approach is putting WiceGrid functions into their own erb files, one grid - one file, or into helper files
I know, and I did that in the end. As I said it isn't a problem as much as it is a curiosity. That it worked fine in development environment but not in production.
Sorry for opening and Issue for this, just wanted to share it.
It's OK. Years ago, in the Stone Age of Rails, this library had an ERB mode where you could intermingle such a helper with ERB like this:
<% grid do %>
<% column do |g| %>
<p><%= g.id%></p>
<% end %>
<% end %>
but then I realized this was not good and removed it
Hi, I debugged this and found out, that .html_safe at the end of the block helps:
= grid(@records_grid) { |g| my_grid_block(g) }.html_safe
It doesn't look like it's unsafe to do this, since when pretty mode is true, it's html_safe? by default.
To see this problem in development you may turn of pretty printing in slim in config/environments/development.rb:
Slim::Engine.set_options pretty: false
I can't say if it's a bug in wice_grid or in slim. I just guess, that it has to do with the usage of content_tag or any other callbacks of the rendering engine in wice_grid_view_helpers.rb
Hi this isn't a huge issue, but for some reason when I use slim for my grid partial, it is rendered as escaped html code in production environment.
When I rewrote it to erb (which is nicer after all) it works fine.
Just thought this was a weird issue.
Thank for your library.