Sha256: 967ebe8fcd2bd27588752a56da489fd6e28e2ebcd1c46e7aee22884d19493c83
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 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 # Rails 4.0, TagHelper. def tag_option(key, value, escape) super(key, value, false) end def content_tag_string(name, content, options, escape=true) super(name, content, options, false) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cells-slim-0.0.2 | lib/cell/slim.rb |