lib/rails-footnotes/footnotes.rb in rails-footnotes-3.6.5 vs lib/rails-footnotes/footnotes.rb in rails-footnotes-3.6.6

- old
+ new

@@ -6,11 +6,11 @@ # Default link prefix is textmate @@prefix = 'txmt://open?url=file://%s&amp;line=%d&amp;column=%d' # Edit notes - @@notes = [ :controller, :view, :layout, :stylesheets, :javascripts ] + @@notes = [ :controller, :view, :layout, :partials, :stylesheets, :javascripts ] # Show notes @@notes += [ :assigns, :session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general ] # Change queries for rpm note when available # if defined?(NewRelic) @@ -117,11 +117,13 @@ end end protected def valid? - performed_render? && valid_format? && valid_content_type? && @body.is_a?(String) && !component_request? && !xhr? + performed_render? && valid_format? && valid_content_type? && + @body.is_a?(String) && !component_request? && !xhr? && + !footnotes_disabled? end def add_footnotes_without_validation! initialize_notes! insert_styles unless @@no_style @@ -154,18 +156,23 @@ def xhr? @controller.request.xhr? end + def footnotes_disabled? + @controller.params[:footnotes] == "false" + end + # # Insertion methods # def insert_styles insert_text :before, /<\/head>/i, <<-HTML <!-- Footnotes Style --> <style type="text/css"> #footnotes_debug {margin: 2em 0 1em 0; text-align: center; color: #444; line-height: 16px;} + #footnotes_debug th, #footnotes_debug td {color: #444; line-height: 18px;} #footnotes_debug a {text-decoration: none; color: #444; line-height: 18px;} #footnotes_debug table {text-align: center;} #footnotes_debug table td {padding: 0 5px;} #footnotes_debug tbody {text-align: left;} #footnotes_debug .name_values td {vertical-align: top;}