Michael Schuerig
2010-Sep-01 13:28 UTC
Views: comments for template and partial location in filesystem?
I''m looking for an extension (gem, plugin, whatever) that inserts comments like <!-- begin partial app/views/things/_thing.html.erb --%> ... <!-- end partial app/views/things/_thing.html.erb --%> around rendered templates (except in production env). A cursory search didn''t bring up anything, but I may have chosen the wrong terms. It doesn''t have to work for arbitrary template engines, ERB is enough. Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-01 13:44 UTC
Re: Views: comments for template and partial location in filesystem?
Michael Schuerig wrote:> I''m looking for an extension (gem, plugin, whatever) that inserts > comments like > > <!-- begin partial app/views/things/_thing.html.erb --%> > ... > <!-- end partial app/views/things/_thing.html.erb --%> > > around rendered templates (except in production env). A cursory search > didn''t bring up anything, but I may have chosen the wrong terms. It > doesn''t have to work for arbitrary template engines, ERB is enough.You want Frederick Cheung''s Tattler: http://github.com/fcheung/tattler . I think it will work with any template engine; certainly I''m using it with Haml. I don''t know if it works with Rails 3 yet.> > Michael > > -- > Michael Schuerig > mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org > http://www.schuerig.de/michael/Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Schuerig
2010-Sep-01 22:46 UTC
Re: Views: comments for template and partial location in filesystem?
On Wednesday 01 September 2010, Marnen Laibow-Koser wrote:> Michael Schuerig wrote: > > I''m looking for an extension (gem, plugin, whatever) that inserts > > comments like > > > > <!-- begin partial app/views/things/_thing.html.erb --%> > > ... > > <!-- end partial app/views/things/_thing.html.erb --%> > > > > around rendered templates (except in production env). A cursory > > search didn''t bring up anything, but I may have chosen the wrong > > terms. It doesn''t have to work for arbitrary template engines, ERB > > is enough. > > You want Frederick Cheung''s Tattler: > http://github.com/fcheung/tattler . I think it will work with any > template engine; certainly I''m using it with Haml. I don''t know if > it works with Rails 3 yet.Tattler doesn''t work with Rails 3 anymore. This little bit of code, inspired by it, does. unless Rails.env.production? class ActionView::Template def render_with_comment(*args, &block) render_result = render_without_comment(*args, &block) if mime_type.nil? || mime_type === [Mime::HTML, Mime::XML] ("<!-- TEMPLATE: #{identifier} -->\n" + render_result + "\n<!-- ENDTEMPLATE: #{identifier} -->" ).html_safe else render_result end end alias_method_chain :render, :comment end end Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.