Module: ContentstackUtils::GQL
- Includes:
- ContentstackUtils
- Defined in:
- lib/contentstack_utils/utils.rb
Constant Summary
Constants included from ContentstackUtils
Class Method Summary collapse
Methods included from ContentstackUtils
json_doc_to_html, render_content
Class Method Details
.json_to_html(content, options) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/contentstack_utils/utils.rb', line 141 def self.json_to_html(content, ) = [] if content.has_key? 'embedded_itemsConnection' = content['embedded_itemsConnection']['edges'] || [] end reference = -> (){ result = "" if != nil object = .select { || ['node']["system"]["uid"] == .item_uid } if object != nil && object.length() > 0 result = .render_option(object[0]["node"], ) end end result } if content.has_key? 'json' json = content['json'] if (json.instance_of? Array) result = [] json.each do |n| result.push(ContentstackUtils.json_doc_to_html(n, , reference)) end result elsif json.instance_of? Hash ContentstackUtils.json_doc_to_html(json, , reference) end end end |