Module: Basemate::Ui::Core::ApplicationHelper

Included in:
App::Cell::App, Component::Cell::Dynamic, Page::Cell::Page
Defined in:
app/helpers/basemate/ui/core/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_component(page_class, component_key) ⇒ Object



13
14
15
16
17
18
# File 'app/helpers/basemate/ui/core/application_helper.rb', line 13

def render_component(page_class, component_key)
  page_class.new(nil, context: {
    params: params,
    request: request
  }, controller_instance: self).call(:show, component_key)
end

#render_page(page_class, only_page = false) ⇒ Object



6
7
8
9
10
11
# File 'app/helpers/basemate/ui/core/application_helper.rb', line 6

def render_page(page_class, only_page=false)
  page_class.new(nil, context: {
    params: params,
    request: request
  }, controller_instance: self).call(:show, nil, only_page)
end

#responder_for(page_class, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/basemate/ui/core/application_helper.rb', line 20

def responder_for(page_class, options = {})
  unless params[:component_key].blank?
    render plain: render_component(page_class, params[:component_key])
    return
  end
  if params[:only_page]
    render html: render_page(page_class, true)
  else
    render html: render_page(page_class), layout: true
  end
end