Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/rails_view_annotator/action_view/partial_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def self.augment_partial_renderer klass
if inner.present?
comment_pattern = "%{partial}"
template_formats = RailsViewAnnotator.extract_requested_formats_from(args)
if template_formats.include?(:text) # Do not render any comments for raw plaintext repsonses
return inner
elsif template_formats.include?(:js)
if template_formats == [:js]
comment_pattern = "/* begin: %{comment} */\n#{comment_pattern}/* end: %{comment} */"
elsif template_formats.empty? || template_formats.include?(:html)
elsif template_formats == [:html]
comment_pattern = "<!-- begin: %{comment} -->\n#{comment_pattern}<!-- end: %{comment} -->"
else
return inner # Do not render any comments for responses we do not support
end

(comment_pattern % {:partial => inner, :comment => descriptor}).html_safe
Expand Down