Sha256: 4a9524f0789c770d5ebb6b9e324fa7512c855d1bdfa635f0af0cc16719dfa0b1
Contents?: true
Size: 571 Bytes
Versions: 1
Compression:
Stored size: 571 Bytes
Contents
module BootstrapHelper def form_with_source(&block) form_html = capture(&block) tag.div(class: "example") do concat(form_html) concat(toggle) concat(codemirror(form_html)) end end private def codemirror(form_html) tag.div(class: "code", style: "display: none") do tag.textarea(class: "codemirror") do HtmlBeautifier.beautify(form_html.strip.gsub(">", ">\n").gsub("<", "\n<")) end end end def toggle tag.button(class: "toggle btn btn-sm btn-info") do "Show Source Code" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_form-5.0.0 | demo/app/helpers/bootstrap_helper.rb |