trailblazer / formular

Form builder for Ruby. Fast, Furious, and Framework-Agnostic.
MIT License
81 stars 17 forks source link

Convert checkable_label method to html_context #12

Closed fran-worley closed 8 years ago

fran-worley commented 8 years ago

Fixes #5.

I've converted the checkable_label method to an HtmlBlock context.

This flows better to me as the idea behind the html_blocks is to define what you want your html to look like. Defining simple html in a method is fine, but when it gets more complex it should really be an html_block.

You can provide your own block by overriding it in your class e.g.

html(:checkable_label) do |input|
  Formular::Elements::Label.(input.options[:label_options]) do
    concat input.to_html(context: :default)
    concat Span.()
    concat " #{input.label_text}"
  end
end
blelump commented 8 years ago

I'm fine with this and you can merge it. :fireworks: