Module: Glib::JsonUi::PageHelper

Defined in:
app/helpers/glib/json_ui/page_helper.rb

Defined Under Namespace

Classes: Page

Instance Method Summary collapse

Instance Method Details

#glib_chat_url(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'app/helpers/glib/json_ui/page_helper.rb', line 13

def glib_chat_url(options = {})
  Glib::Web::Engine.routes.url_helpers.chat_url(options.merge(
                                                  protocol: request.protocol,
                                                  host: request.host,
                                                  port: request.port,
                                                  _render: params[:_render], format: params[:format])
  )
end

#json_ui_action(json) ⇒ Object



59
60
61
62
# File 'app/helpers/glib/json_ui/page_helper.rb', line 59

def json_ui_action(json)
  @__json_ui_action ||= Page.new(json, self)
  @__json_ui_action.action_builder
end

#json_ui_action_payload(&block) ⇒ Object

def json_ui_view(json)

@__json_ui_view ||= Page.new(json, self)
@__json_ui_view.view_builder

end



69
70
71
72
73
# File 'app/helpers/glib/json_ui/page_helper.rb', line 69

def json_ui_action_payload(&block)
  dataJson = Jbuilder.new
  block&.call Page.new(dataJson, self).action_builder
  dataJson.attributes!
end

#json_ui_garage_current_url(options = {}) ⇒ Object



22
23
24
# File 'app/helpers/glib/json_ui/page_helper.rb', line 22

def json_ui_garage_current_url(options = {})
  json_ui_garage_url(options.merge(path: params[:path]))
end

#json_ui_garage_url(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/helpers/glib/json_ui/page_helper.rb', line 4

def json_ui_garage_url(options = {})
  Glib::Web::Engine.routes.url_helpers.json_ui_garage_url(options.merge(
                                                            protocol: request.protocol,
                                                            host: request.host,
                                                            port: request.port,
                                                            _render: params[:_render], format: params[:format])
  )
end

#json_ui_page(json, &block) ⇒ Object

TODO: Remove the block



27
28
29
30
31
32
33
34
# File 'app/helpers/glib/json_ui/page_helper.rb', line 27

def json_ui_page(json, &block)
  @__json_ui_page ||= Page.new(json, self)

  __json_ui_analytics(json)

  block&.call @__json_ui_page
  @__json_ui_page
end

#json_ui_section(json) ⇒ Object

# Use this only if you need to generate json independently from the current ‘json_ui_page` def json_ui_panel(&block)

@__json_ui_panel_page ||= Page.new(Jbuilder.new, self)
json = @__json_ui_panel_page.json
json.nil!
block&.call @__json_ui_panel_page.view_builder
json.attributes!

end



54
55
56
57
# File 'app/helpers/glib/json_ui/page_helper.rb', line 54

def json_ui_section(json)
  @__json_ui_section ||= Page.new(json, self)
  @__json_ui_section.list_section_builder
end