class Forme::InputsWrapper::Bs5Table

  1. lib/forme/bs5.rb
Superclass: Object

Use a <table class=“table”> tag to wrap the inputs.

Registered as :bs5_table.

Methods

Public Instance

  1. call

Public Instance methods

call(form, opts, &block)

Wrap the inputs in a <table> tag.

[show source]
    # File lib/forme/bs5.rb
100 def call(form, opts, &block)
101   attr = opts[:attr] ? opts[:attr].dup : { :class=>'table table-bordered'}
102   form.tag(:table, attr) do
103     if legend = opts[:legend]
104       form.tag(:caption, opts[:legend_attr], legend)
105     end
106 
107     if (labels = opts[:labels]) && !labels.empty?
108       form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)})
109     end
110 
111     yield
112   end
113 end