Class: ComfortableMexicanSofa::Content::Tag::Checkbox
- Inherits:
-
Fragment
- Object
- ComfortableMexicanSofa::Content::Tag
- Fragment
- ComfortableMexicanSofa::Content::Tag::Checkbox
- Defined in:
- lib/comfortable_mexican_sofa/content/tags/checkbox.rb
Overview
Tag for boolean content that is going to be rendered using checkbox
{{ cms:checkbox identifier }}
Instance Attribute Summary
Attributes inherited from Fragment
#identifier, #namespace, #options, #renderable
Attributes inherited from ComfortableMexicanSofa::Content::Tag
Instance Method Summary collapse
Methods inherited from Fragment
#form_field_id, #fragment, #initialize, #render
Methods inherited from ComfortableMexicanSofa::Content::Tag
#allow_erb?, #initialize, #nodes, #render
Constructor Details
This class inherits a constructor from ComfortableMexicanSofa::Content::Tag::Fragment
Instance Method Details
#content ⇒ Object
8 9 10 |
# File 'lib/comfortable_mexican_sofa/content/tags/checkbox.rb', line 8 def content fragment.boolean end |
#form_field(object_name, view, index) {|input| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/comfortable_mexican_sofa/content/tags/checkbox.rb', line 12 def form_field(object_name, view, index) name = "#{object_name}[fragments_attributes][#{index}][boolean]" input = view.content_tag(:div, class: "form-check mt-2") do view.concat view.hidden_field_tag(name, "0", id: nil) = { id: form_field_id, class: "form-check-input position-static" } view.concat view.check_box_tag(name, "1", content.present?, ) end yield input end |