Module: Redmine::SudoMode::Helper
- Included in:
- ApplicationHelper
- Defined in:
- lib/redmine/sudo_mode.rb
Instance Method Summary collapse
-
#hash_to_hidden_fields(hash) ⇒ Object
Represents params data from hash as hidden fields.
Instance Method Details
#hash_to_hidden_fields(hash) ⇒ Object
Represents params data from hash as hidden fields
taken from github.com/brianhempel/hash_to_hidden_fields
32 33 34 35 36 37 38 39 40 |
# File 'lib/redmine/sudo_mode.rb', line 32 def hash_to_hidden_fields(hash) cleaned_hash = hash.to_unsafe_h.reject {|k, v| v.nil?} pairs = cleaned_hash.to_query.split(Rack::Utils::DEFAULT_SEP) = pairs.map do |pair| key, value = pair.split('=', 2).map {|str| Rack::Utils.unescape(str)} hidden_field_tag(key, value) end .join("\n").html_safe end |