Sha256: 391fede556e9c8cc2d32dd9789a70670482b92de348ec939309b828acb415ac6
Contents?: true
Size: 1.47 KB
Versions: 7
Compression:
Stored size: 1.47 KB
Contents
class ComfortableMexicanSofa::FormBuilder < BootstrapForm::FormBuilder def default_label_col "col-sm-2 text-md-right" end def field(record, tag, index) object_name = record.class.to_s.demodulize.underscore tag.form_field(object_name, @template, index) do |tag_input| name = "#{object_name}[fragments_attributes][#{index}][identifier]" identifer_input = @template.hidden_field_tag(name, tag.identifier, id: nil) name = "#{object_name}[fragments_attributes][#{index}][tag]" value = tag.class.to_s.demodulize.underscore tag_name_input = @template.hidden_field_tag(name, value, id: nil) label = I18n.t("comfy.cms.content.tag.#{tag.identifier}", default: tag.identifier.titleize) renderable = tag.respond_to?(:renderable) ? tag.renderable : true form_group label: { text: label, class: "renderable-#{renderable}" } do [identifer_input, tag_name_input, tag_input].join.html_safe end end end # Wrapper for form action that is sticking to the bottom of the viewport def form_actions(&block) <<-HTML.strip_heredoc.html_safe <div class="form-actions bg-light"> <div class="row"> <div class="col-lg-2"></div> <div class="col-lg-8"> <div class="row"> <div class="col-sm-2"></div> <div class="col-sm-10"> #{capture(&block)} </div> </div> </div> </div> </div> HTML end end
Version data entries
7 entries across 7 versions & 1 rubygems