Class: Footnotes::Notes::EnvNote
- Inherits:
-
AbstractNote
- Object
- AbstractNote
- Footnotes::Notes::EnvNote
- Defined in:
- lib/rails-footnotes/notes/env_note.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(controller) ⇒ EnvNote
constructor
A new instance of EnvNote.
Methods inherited from AbstractNote
close!, #escape, #has_fieldset?, #hash_to_xml_attributes, included?, #javascript, #legend, #link, #mount_table, #mount_table_for_hash, #onclick, #prefix?, #row, start!, #stylesheet, #title, title, #to_sym, to_sym, #valid?
Constructor Details
#initialize(controller) ⇒ EnvNote
Returns a new instance of EnvNote.
4 5 6 |
# File 'lib/rails-footnotes/notes/env_note.rb', line 4 def initialize(controller) @env = controller.request.env.dup end |
Instance Method Details
#content ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rails-footnotes/notes/env_note.rb', line 8 def content env_data = @env.map { |k, v| case k when 'HTTP_COOKIE' # Replace HTTP_COOKIE for a link [k.to_s, '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>'] else [k.to_s, escape(v.to_s)] end }.sort.unshift([ :key, escape('value') ]) # Create the env table mount_table(env_data) end |