Module: LesliView::Forms::Fieldset

Included in:
Builder
Defined in:
lib/lesli_view/forms/fieldset.rb

Instance Method Summary collapse

Instance Method Details

#fieldset(legend = "", options = {}, category: nil, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/lesli_view/forms/fieldset.rb', line 4

def fieldset(legend = "", options = {}, category: nil, &block)
    options[:class] = ["lesli-form-fieldset", "box", "pr-6", "is-#{category}"]
    options[:class].push("pt-5") unless legend.present?

    @template.(:fieldset, options) do
        legend_html = legend.present? ? @template.(:h5, legend, class: ["is-size-5", "mb-5", "ml-2"]) : nil
        @template.safe_join([legend_html, @template.capture(&block)].compact)
    end
end