Class: Sinicum::Templating::DialogResolver

Inherits:
Object
  • Object
show all
Includes:
Jcr::ApiClient, TemplatingUtils
Defined in:
lib/sinicum/templating/dialog_resolver.rb

Overview

Private: Provides information about Magnolia dialogs.

Instance Method Summary collapse

Methods included from Jcr::ApiClient

#api_get, #api_post

Methods included from Logger

included, #logger

Instance Method Details

#dialog_for_node(node) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sinicum/templating/dialog_resolver.rb', line 8

def dialog_for_node(node)
  result = nil
  template = split_template_path(node.mgnl_template)
  path = "/_templating/dialogs/#{template[:type]}" \
    "/#{template[:module]}/#{template[:name]}"
  response = api_get(path)
  if response.ok?
    begin
      json = MultiJson.load(response.body)
      result = json["dialog"]
    rescue
      # nothing
    end
  end
  result
end