class Bootstrap::ViewHelpers::Components::Accordion::Button

Protected Instance Methods

assign_and_validate_style() click to toggle source
# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 29
def assign_and_validate_style
  @style = ContextualClasses::LINK
end
expanded?() click to toggle source

rubocop:disable Style/DoubleNegation

# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 38
def expanded?
  @expanded ||= !!options.delete(:expanded)
end
html_options() click to toggle source
# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 25
def html_options
  options.merge({ type: :button })
end
inject_aria_attributes() click to toggle source
# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 8
def inject_aria_attributes
  options[:aria] ||= {}
  options[:aria][:expanded] = expanded?
  options[:aria][:controls] = target
end
inject_class_name_to_options() click to toggle source
# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 20
def inject_class_name_to_options
  super
  options[:class] << ' btn-block text-left py-2 px-3'
end
inject_data_attributes() click to toggle source
# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 14
def inject_data_attributes
  options[:data] ||= {}
  options[:data][:toggle] = 'collapse'
  options[:data][:target] = "##{target}"
end
parse_options(options) click to toggle source

rubocop:disable Style/DoubleNegation

# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 44
def parse_options(options)
  super
  @target = options.delete(:target)
  @expanded = !!options.delete(:expanded)
end
target() click to toggle source
# File lib/bootstrap/view_helpers/components/accordion/button.rb, line 33
def target
  @target ||= options.delete(:target)
end