Module: Playbook::PbKitHelper

Defined in:
app/helpers/playbook/pb_kit_helper.rb

Instance Method Summary collapse

Instance Method Details

#pb_rails(kit, props: {}, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/helpers/playbook/pb_kit_helper.rb', line 9

def pb_rails(kit, props: {}, &block)
  previous = prefix_partial_path_with_controller_namespace
  self.prefix_partial_path_with_controller_namespace = false
  kit = build_view_model(kit.to_s, props, &block)
  render(partial: kit, as: :object)
ensure
  self.prefix_partial_path_with_controller_namespace = previous
end

#pb_react(kit, props: {}, options: {}) ⇒ Object



18
19
20
# File 'app/helpers/playbook/pb_kit_helper.rb', line 18

def pb_react(kit, props: {}, options: {})
  ::Webpacker::React::Component.new(kit.camelize).render(props, options)
end