elasticsearch_plugin_helper.rb 542 Bytes
module ElasticsearchPluginHelper

  def render_categories collection
    content_tag :ul, class: "category-ident" do
      if collection.respond_to? :each
        collection.collect do |item|
          concat ("<li>".html_safe)
          concat (check_box_tag item.name)
          concat (item.name)
          concat (render_categories item.children) if item.children_count
          concat ("</li>".html_safe)
        end
      else
        check_box_tag collection.name
        content_tag :li, collection.name
      end
    end
  end

end