Sha256: 739528ba18e09e5e7b5b493e36c2d9d4fe36e2170d70c52f1f8c352bbc17a26b
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
module Knitkit class OnlineDocumentSectionsController < BaseController layout 'knitkit/online_document_sections' before_filter :find_root before_filter :find_document_sections, :only => :build_tree def index end def build_tree render :inline => build_document_hash.to_json end protected def id_or_node (params[:node].to_i == 0) ? params[:section_id] : params[:node] end def find_root @root = OnlineDocumentSection.find(params[:section_id]) if @root.documented_item_published_content(@active_publication) @root_content = @root.documented_item_published_content(@active_publication).body_html.gsub(/\n/, '<br/>') else @root_content = "" end end def find_document_sections @document_sections = OnlineDocumentSection.find(id_or_node).positioned_children end def build_document_hash [].tap do |documents| @document_sections.each do |section| documents << {:id => section.id, :title => section.title, :leaf => section.leaf, :documented_item_published_content_html => section.documented_item_published_content_html(@active_publication)} end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knitkit-2.1.3 | app/controllers/knitkit/online_document_sections_controller.rb |