Module: Cell::Hamlit
- Defined in:
- lib/cell/hamlit.rb,
lib/cell/hamlit/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
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
32 33 34 |
# File 'lib/cell/hamlit.rb', line 32 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
45 46 47 |
# File 'lib/cell/hamlit.rb', line 45 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?
17 18 19 20 |
# File 'lib/cell/hamlit.rb', line 17 def form_tag_in_block(, &block) content = capture(&block) form_tag_with_body(, content) end |
#form_tag_with_body(html_options, content) ⇒ Object
22 23 24 |
# File 'lib/cell/hamlit.rb', line 22 def form_tag_with_body(, content) "#{form_tag_html()}" << content.to_s << "</form>" end |
#template_options_for(options) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/cell/hamlit.rb', line 6 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.
28 29 30 |
# File 'lib/cell/hamlit.rb', line 28 def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new) yield end |