class Para::FormBuilder::Tabs::TabsManager
Attributes
Public Class Methods
Source
# File lib/para/form_builder/tabs.rb, line 15 def initialize(template, object, builder, options) @template = template @object = object @builder = builder @options = options end
Public Instance Methods
Source
# File lib/para/form_builder/tabs.rb, line 31 def finalize! # Set all tabs as inactive if one of the tabs was set to be active # manually if tabs.any?(&:active) active_already_set = false tabs.each do |tab| # Get a boolean value for the current active state of the tab tab_active = !!tab.active tab.active = !active_already_set && tab_active # Set the "already set" flag to true once we found one active # tab, forcing `active = false` for all further tabs active_already_set ||= tab_active end end end
Source
# File lib/para/form_builder/tabs.rb, line 22 def tab(identifier, options = {}, &block) tabs << Tab.new(template, object, builder, identifier, options, tabs.length, &block) nil end