Sha256: c141df616fcf36d0364d7079f0ee8773a0f6c082256afa2a326fe5d1cb187188
Contents?: true
Size: 765 Bytes
Versions: 10
Compression:
Stored size: 765 Bytes
Contents
# frozen_string_literal: true # Tag for boolean content that is going to be rendered using checkbox # {{ cms:checkbox identifier }} # class Occams::Content::Tag::Checkbox < Occams::Content::Tag::Fragment def content fragment.boolean end 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) options = { id: form_field_id, class: 'form-check-input position-static' } view.concat view.check_box_tag(name, '1', content.present?, options) end yield input end end Occams::Content::Renderer.register_tag( :checkbox, Occams::Content::Tag::Checkbox )
Version data entries
10 entries across 10 versions & 1 rubygems