Class: NfgUi::Bootstrap::Components::ListGroupItem

Inherits:
Base
  • Object
show all
Includes:
Utilities::Activatable, Utilities::Disableable, Utilities::Themeable, Utilities::Wrappable
Defined in:
lib/nfg_ui/bootstrap/components/list_group_item.rb

Overview

Bootstrap List Group Item Component getbootstrap.com/docs/4.1/components/list-group/

Direct Known Subclasses

Components::Elements::ListGroupItem

Instance Attribute Summary

Attributes included from Utilities::Disableable

#as

Attributes included from Utilities::Wrappable

#as

Attributes inherited from Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Utilities::Themeable

#outlined, #theme

Methods included from Utilities::Disableable

#disabled

Methods included from Utilities::Activatable

#active

Methods included from Utilities::Wrappable

#utility_initialize

Methods inherited from Base

#data, #href, #html_options, #id, #initialize, #style

Constructor Details

This class inherits a constructor from NfgUi::Bootstrap::Components::Base

Instance Method Details

#actionObject



18
19
20
# File 'lib/nfg_ui/bootstrap/components/list_group_item.rb', line 18

def action
  options.fetch(:action, false)
end

#badgeObject



22
23
24
# File 'lib/nfg_ui/bootstrap/components/list_group_item.rb', line 22

def badge
  options.fetch(:badge, nil)
end

#component_familyObject



14
15
16
# File 'lib/nfg_ui/bootstrap/components/list_group_item.rb', line 14

def component_family
  :list_group
end

#renderObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/nfg_ui/bootstrap/components/list_group_item.rb', line 26

def render
  super do
    capture do
      concat(block_given? ? yield : body)
      if badge
        concat(NfgUi::Bootstrap::Components::Badge.new({ pill: true, theme: (theme || NfgUi::DEFAULT_BOOTSTRAP_THEME), body: badge }, view_context).render)
      end
    end
  end
end