Module: Cell::Hamlit
- Defined in:
- lib/cell/hamlit.rb,
lib/cell/hamlit/version.rb
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Method Summary collapse
- #capture(*args) {|args| ... } ⇒ Object
-
#content_tag(name, content_or_options_with_block = nil, options = nil, escape = false, &block) ⇒ Object
def form_for(*args, &block) # TODO: remove this once Haml 4.1 is out.
-
#form_tag_in_block(html_options, &block) ⇒ Object
From FormTagHelper.
- #form_tag_with_body(html_options, content) ⇒ Object
- #template_options_for(options) ⇒ Object
-
#with_output_buffer(block_buffer = ViewModel::OutputBuffer.new) ⇒ Object
with fine Hamlit, we don’t need magical output buffers since yielding a block returns the content.
Instance Method Details
#capture(*args) {|args| ... } ⇒ Object
31 32 33 |
# File 'lib/cell/hamlit.rb', line 31 def capture(*args) yield(*args) end |
#content_tag(name, content_or_options_with_block = nil, options = nil, escape = false, &block) ⇒ Object
def form_for(*args, &block) # TODO: remove this once Haml 4.1 is out. the form_for_with_haml is buggy.
form_for_without_haml(*args, &block)
end
44 45 46 |
# File 'lib/cell/hamlit.rb', line 44 def content_tag(name, =nil, =nil, escape=false, &block) super end |
#form_tag_in_block(html_options, &block) ⇒ Object
From FormTagHelper. why do they escape every possible string? why?
16 17 18 19 |
# File 'lib/cell/hamlit.rb', line 16 def form_tag_in_block(, &block) content = capture(&block) form_tag_with_body(, content) end |
#form_tag_with_body(html_options, content) ⇒ Object
21 22 23 |
# File 'lib/cell/hamlit.rb', line 21 def form_tag_with_body(, content) "#{form_tag_html()}" << content.to_s << "</form>" end |
#template_options_for(options) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/cell/hamlit.rb', line 5 def () { escape_html: false, template_class: ::Hamlit::Template, suffix: "haml" } end |
#with_output_buffer(block_buffer = ViewModel::OutputBuffer.new) ⇒ Object
with fine Hamlit, we don’t need magical output buffers since yielding a block returns the content.
27 28 29 |
# File 'lib/cell/hamlit.rb', line 27 def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new) yield end |