module PandaCms module EditorJs module Blocks class List < Base def render list_type = (data["style"] == "ordered") ? "ol" : "ul" html_safe( "<#{list_type}>" \ "#{render_items(data["items"])}" \ "#{list_type}>" ) end private def render_items(items) items.map do |item| content = item.is_a?(Hash) ? item["content"] : item nested = (item.is_a?(Hash) && item["items"].present?) ? render_nested(item["items"]) : "" "