class Bootstrap4Helper::Tab::Content
Build a Content
component to be used with Tabs
Public Class Methods
new(template, opts = {}, &block)
click to toggle source
Class constructor
@param [ActionView] template @param [Hash] opts @option opts [String] :id @option opts [String] :class @option opts [Hash] :data
Calls superclass method
Bootstrap4Helper::Component::new
# File lib/bootstrap4_helper/tab/content.rb, line 15 def initialize(template, opts = {}, &block) super(template) @id = opts.fetch(:id, uuid) @class = opts.fetch(:class, '') @data = opts.fetch(:data, {}) @content = block || proc { '' } end
Public Instance Methods
pane(source, opts = {}, &block)
click to toggle source
Builds the pane for the tab.
@param [Symbol] source @param [Hash] opts @option opts [String] :class @option opts [Hash] :data @return [String]
# File lib/bootstrap4_helper/tab/content.rb, line 32 def pane(source, opts = {}, &block) id = opts.fetch(:id, source) klass = opts.fetch(:class, '') data = opts.fetch(:data, {}) content_tag( :div, id: id, class: "tab-pane #{klass}", role: 'tabpanel', data: data, &block ) end
to_s()
click to toggle source
String representation of the object.
@return [String]
# File lib/bootstrap4_helper/tab/content.rb, line 51 def to_s content_tag :div, id: @id, class: "tab-content #{@class}" do @content.call(self) end end