Class: Formatic::Checklist
- Inherits:
-
Base
- Object
- ViewComponent::Base
- ApplicationComponent
- Base
- Formatic::Checklist
- Defined in:
- app/components/formatic/checklist.rb
Overview
Multiple checkboxes for an Array of values in one attribute.
Instance Method Summary collapse
Methods inherited from Base
#input_name, #param_key, #value, #wrapper
Methods inherited from ApplicationComponent
Constructor Details
This class inherits a constructor from Formatic::ApplicationComponent
Instance Method Details
#choices ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/components/formatic/checklist.rb', line 43 def choices ::Formatic::Choices.call( f:, attribute_name:, options:, records:, keys:, include_current:, include_blank: false ) end |
#split_and_wrap(string) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'app/components/formatic/checklist.rb', line 55 def split_and_wrap(string) parts = string.split(' ') return parts.first if parts.size == 1 main_part = parts[0..-2].join(' ') last_part = parts.last ::Formatic::SafeJoin.call(main_part, '<br/>'.html_safe, content_tag(:small, last_part)) end |