Class: Bureaucrat::Widgets::Textarea
- Defined in:
- lib/bureaucrat/widgets.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#initialize(attrs = nil) ⇒ Textarea
constructor
A new instance of Textarea.
- #render(name, value, attrs = nil) ⇒ Object
Methods inherited from Widget
#build_attrs, #has_changed?, #hidden?, id_for_label, inherited, #initialize_copy, #media, #value_from_datahash
Methods included from Utils
conditional_escape, escape, flatatt, format_string, make_bool, make_float, mark_safe, pretty_name, security_hash
Constructor Details
#initialize(attrs = nil) ⇒ Textarea
Returns a new instance of Textarea.
253 254 255 256 257 |
# File 'lib/bureaucrat/widgets.rb', line 253 def initialize(attrs=nil) # The 'rows' and 'cols' attributes are required for HTML correctness. @attrs = {:cols => '40', :rows => '10'} @attrs.merge!(attrs) if attrs end |
Instance Method Details
#render(name, value, attrs = nil) ⇒ Object
259 260 261 262 263 |
# File 'lib/bureaucrat/widgets.rb', line 259 def render(name, value, attrs=nil) value ||= '' final_attrs = build_attrs(attrs, :name => name) mark_safe("<textarea#{flatatt(final_attrs)}>#{conditional_escape(value.to_s)}</textarea>") end |