Class: NfgUi::UI::Base
- Inherits:
-
Object
- Object
- NfgUi::UI::Base
- Defined in:
- lib/nfg_ui/ui/base.rb
Overview
The base component building class for namespaced components (bootstrap vs network_for_good / nfg)
Instance Attribute Summary collapse
-
#view_context ⇒ Object
Returns the value of attribute view_context.
Instance Method Summary collapse
- #bootstrap(component_name = nil, *traits, **options, &block) ⇒ Object
-
#initialize(view_context) ⇒ Base
constructor
A new instance of Base.
- #nfg(component_name = nil, *traits, **options, &block) ⇒ Object
Constructor Details
#initialize(view_context) ⇒ Base
Returns a new instance of Base.
10 11 12 |
# File 'lib/nfg_ui/ui/base.rb', line 10 def initialize(view_context) self.view_context = view_context end |
Instance Attribute Details
#view_context ⇒ Object
Returns the value of attribute view_context.
8 9 10 |
# File 'lib/nfg_ui/ui/base.rb', line 8 def view_context @view_context end |
Instance Method Details
#bootstrap(component_name = nil, *traits, **options, &block) ⇒ Object
14 15 16 17 |
# File 'lib/nfg_ui/ui/base.rb', line 14 def bootstrap(component_name = nil, *traits, **, &block) traits, = (*traits, **) NfgUi::UI::Bootstrap.new(view_context, component_name, *traits, **, &block).render_component end |
#nfg(component_name = nil, *traits, **options, &block) ⇒ Object
19 20 21 22 23 |
# File 'lib/nfg_ui/ui/base.rb', line 19 def nfg(component_name = nil, *traits, **, &block) traits, = (*traits, **) return unless render_nfg_component?() NfgUi::UI::NetworkForGood.new(view_context, component_name, *traits, **, &block).render_component end |