class NfgUi::Bootstrap::Components::Table

Bootstrap Table Component getbootstrap.com/docs/4.1/content/tables/

Public Instance Methods

bordered() click to toggle source
# File lib/nfg_ui/bootstrap/components/table.rb, line 32
def bordered
  options.fetch(:bordered, false)
end
render() click to toggle source
# File lib/nfg_ui/bootstrap/components/table.rb, line 20
def render
  if responsive
    content_tag(:div, class: responsive_css_class) { super }
  else
    super
  end
end
size() click to toggle source
# File lib/nfg_ui/bootstrap/components/table.rb, line 12
def size
  if options.fetch(:size, nil) == :lg
    raise ArgumentError.new I18n.t('nfg_ui.errors.argument_error.components.table.size')
  else
    super
  end
end
striped() click to toggle source
# File lib/nfg_ui/bootstrap/components/table.rb, line 28
def striped
  options.fetch(:striped, false)
end

Private Instance Methods

base_element() click to toggle source
# File lib/nfg_ui/bootstrap/components/table.rb, line 55
def base_element
  :table
end
css_classes() click to toggle source

Remove '.table-responsive' from the table element css classes since a real “responsive table” is actually a <table> wrapped in a div, example:

<div class='table-responsive'>

<table class='table'>
  ...
</table>

</div>

# File lib/nfg_ui/bootstrap/components/table.rb, line 47
def css_classes
  [
    super,
    ("#{component_css_class}-striped" if striped),
    ("#{component_css_class}-bordered" if bordered)
  ].join(' ')&.remove!(responsive_css_class)&.squish # see above note
end
non_html_attribute_options() click to toggle source
# File lib/nfg_ui/bootstrap/components/table.rb, line 59
def non_html_attribute_options
  super.push(:striped, :bordered)
end