Module: Voncount::FormTagHelperExt
- Defined in:
- lib/voncount/voncount_form_helpers.rb
Instance Method Summary collapse
- #voncount_text_area_tag(name, content = nil, options = {}) ⇒ Object
- #voncount_text_field_tag(name, value = nil, options = {}) ⇒ Object
Instance Method Details
#voncount_text_area_tag(name, content = nil, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/voncount/voncount_form_helpers.rb', line 11 def voncount_text_area_tag(name, content = nil, = {}) [:class] = "von-countable #{options[:class]}" = .stringify_keys if size = .delete("size") ["cols"], ["rows"] = size.split("x") if size.respond_to?(:split) end escape = .delete("escape") { true } content = ERB::Util.html_escape(content) if escape [:class] = "von-countable #{options[:class]}" content_tag :div, class: "von-count-holder" do content_tag(:textarea, content.to_s.html_safe, { "name" => name, "id" => sanitize_to_id(name) }.update()) + content_tag(:span, '0', class: "von-counter") end end |
#voncount_text_field_tag(name, value = nil, options = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/voncount/voncount_form_helpers.rb', line 3 def voncount_text_field_tag(name, value = nil, = {}) [:class] = "von-countable #{options[:class]}" content_tag :div, class: "von-count-holder" do tag(:input, { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(.stringify_keys)) + content_tag(:span, '0', class: "von-counter") end end |