Class: Formular::Element::Foundation6::InputGroup
Defined Under Namespace
Modules: WrappedGroup
Classes: Button, Label, Wrapper
Constant Summary
Constants included
from HtmlEscape
HtmlEscape::HTML_ESCAPE, HtmlEscape::HTML_ESCAPE_ONCE_REGEXP, HtmlEscape::HTML_ESCAPE_REGEXP
Instance Method Summary
collapse
Methods included from Module
included
#wrapper
Methods included from HtmlEscape
#html_escape, #html_escape_once
Instance Method Details
54
55
56
57
58
59
60
|
# File 'lib/formular/element/foundation6/input_group.rb', line 54
def group_button(content = nil, option_key: nil)
return '' unless content || option_key
addon_content = content || options[option_key]
return '' unless addon_content
Button.(content: addon_content)
end
|
62
63
64
|
# File 'lib/formular/element/foundation6/input_group.rb', line 62
def group_input
to_html(context: :raw_input)
end
|
#group_label(content = nil, option_key: nil) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/formular/element/foundation6/input_group.rb', line 44
def group_label(content = nil, option_key: nil)
return '' unless content || option_key
addon_content = content || options[option_key]
return '' unless addon_content
label_options = { content: addon_content }
label_options[:class] = ['is-invalid-label'] if has_errors?
Label.(label_options)
end
|
66
67
68
69
70
|
# File 'lib/formular/element/foundation6/input_group.rb', line 66
def input_class
return ['input-group-field'] unless has_errors?
['input-group-field', 'is-invalid-input']
end
|
#label_options ⇒ Object
72
73
74
75
76
|
# File 'lib/formular/element/foundation6/input_group.rb', line 72
def label_options
return super unless has_errors?
@label_options ||= Attributes[options[:label_options]].merge(class: ['is-invalid-label'])
end
|