Created
May 27, 2011 19:44
-
-
Save sirneb/995996 to your computer and use it in GitHub Desktop.
show method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
@content = find_content | |
@title = book_title # just a string | |
@comment = Comment.new | |
# @comments_feed = @content.comments | |
@contents_path = make_content_path(@content) # creates location path view | |
@sections = Node.get_top_list # table of contents view | |
@node = @content.node | |
# if @comments_feed != nil | |
# format.html { render 'show_with_comments' } | |
# format.xml { render :xml => @content } | |
# format.js | |
# end | |
respond_to do |format| | |
format.html | |
format.xml { render :xml => @content } | |
format.js | |
end | |
end | |
private | |
# some what depreciated, I was messing around with the routing | |
def find_content | |
if params[:id] == nil | |
content = Content.find_by_title(params[:title]) | |
else | |
content = Content.find(params[:id]) | |
end | |
return content | |
end | |
def book_title | |
"Poker Book" | |
end | |
# it creates a list of contents based on their hierarchical order | |
def make_content_path(content) | |
content_path = Array.new | |
current_node = content.node | |
current_node.get_node_path.each do | node | | |
unless node.pnode_id == nil # skip super_parent | |
content_path << node.content | |
end | |
end | |
return content_path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment