Sha256: 5a0a907359e12e2a580365037768f3c5c32fe54e8b536196929f5c39c42b9552
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
require "slim" require "cells" module Cell module Slim def render_template(*) old_output_buffer = @output_buffer super ensure @output_buffer = old_output_buffer end def template_options_for(options) { template_class: ::Slim::Template, suffix: "slim", disable_escape: true, escape_code: false, use_html_safe: false, buffer: "@output_buffer" } end include ActionView::Helpers::FormHelper def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new) @output_buffer, old_buffer = block_buffer, @output_buffer yield @output_buffer = old_buffer block_buffer end def capture(*args) value = nil buffer = with_output_buffer { value = yield(*args) } return buffer.to_s if buffer.size > 0 value # this applies for "Beachparty" string-only statements. end # From FormTagHelper. why do they escape every possible string? why? def form_tag_in_block(html_options, &block) content = capture(&block) form_tag_with_body(html_options, content) end def form_tag_with_body(html_options, content) "#{form_tag_html(html_options)}" << content.to_s << "</form>" end def form_tag_html(html_options) extra_tags = extra_tags_for_form(html_options) "#{tag(:form, html_options, true) + extra_tags}" end def tag_options(options, escape = true) super(options, true) end def content_tag_string(name, content, options, escape=true) super(name, content, options, false) end def concat(string) @output_buffer << string end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cells-slim-0.0.3 | lib/cell/slim.rb |