class NfgUi::UI::Base
The base component building class for namespaced components (bootstrap vs network_for_good / nfg)
Attributes
view_context[RW]
Public Class Methods
new(view_context)
click to toggle source
# File lib/nfg_ui/ui/base.rb, line 10 def initialize(view_context) self.view_context = view_context end
Public Instance Methods
bootstrap(component_name = nil, *traits, **options, &block)
click to toggle source
# File lib/nfg_ui/ui/base.rb, line 14 def bootstrap(component_name = nil, *traits, **options, &block) NfgUi::UI::Bootstrap.new(view_context, component_name, *traits, **options, &block).render_component end
nfg(component_name = nil, *traits, **options, &block)
click to toggle source
# File lib/nfg_ui/ui/base.rb, line 18 def nfg(component_name = nil, *traits, **options, &block) return unless render_nfg_component?(options) NfgUi::UI::NetworkForGood.new(view_context, component_name, *traits, **options, &block).render_component end
Private Instance Methods
render_nfg_component?(options)
click to toggle source
# File lib/nfg_ui/ui/base.rb, line 25 def render_nfg_component?(options) return true unless options.key?(:render_if) || options.key?(:render_unless) if options.key?(:render_if) options[:render_if] else !options[:render_unless] end end