Padrino::Helpers::TagHelpers
Module: Padrino::Helpers::TagHelpers
Overview
Helpers related to producing html tags within templates.
Constant Summary
- ESCAPE_VALUES =
Tag values escaped to html entities.
{ "&" => "&", "<" => "<", ">" => ">", '"' => """ }.freeze
- ESCAPE_REGEXP =
Cached Regexp for escaping values to avoid rebuilding one on every escape operation.
Regexp.union(*ESCAPE_VALUES.keys).freeze
- BOOLEAN_ATTRIBUTES =
[ :autoplay, :autofocus, :formnovalidate, :checked, :disabled, :hidden, :loop, :multiple, :muted, :readonly, :required, :selected, :declare, :defer, :ismap, :itemscope, :noresize, :novalidate ].freeze
- DATA_ATTRIBUTES =
Custom data attributes, feel free to update with yours:
Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog) text_field :foo, :dialog => true # Generates: <input type="text" data-dialog="true" name="foo" />
[ :method, :remote, :confirm ]
- NEWLINE =
A html_safe newline string to avoid allocating a new on each concatenation.
"\n".html_safe.freeze
Instance Method Summary
-
#content_tag(name, content = nil, options = nil, &block) ⇒ String
Creates an HTML tag with given name, content, and options. -
#input_tag(type, options = {}) ⇒ String
Creates an HTML input field with the given type and options. -
#safe_content_tag(name, content = nil, options = nil, &block) ⇒ Object
Like #content_tag, but assumes its input to be safe and doesn't escape. -
#tag(name, options = nil, open = false) ⇒ String
Creates an HTML tag with the given name and options.
Instance Method Details
#content_tag(name, content, options = nil) ⇒ String #content_tag(name, options = nil, &block) ⇒ String
Creates an HTML tag with given name, content, and options.
#input_tag(type, options = {}) ⇒ String
Creates an HTML input field with the given type and options.
#safe_content_tag(name, content = nil, options = nil, &block) ⇒ Object
Like #content_tag, but assumes its input to be safe and doesn't escape. It also returns safe HTML.
#tag(name, options = nil, open = false) ⇒ String
Creates an HTML tag with the given name and options.
© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Helpers/TagHelpers