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

#glib_direct_uploads_url(options = {}) ⇒ Object



22
23
24
25
26
27
28
29
# File 'app/helpers/glib/json_ui/page_helper.rb', line 22

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

#json_ui_action(json) ⇒ Object



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

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



78
79
80
81
82
# File 'app/helpers/glib/json_ui/page_helper.rb', line 78

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



31
32
33
# File 'app/helpers/glib/json_ui/page_helper.rb', line 31

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



36
37
38
39
40
41
42
43
# File 'app/helpers/glib/json_ui/page_helper.rb', line 36

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



63
64
65
66
# File 'app/helpers/glib/json_ui/page_helper.rb', line 63

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