Skip to content

Commit

Permalink
Merge branch 'release/v0.0.5.pre'
Browse files Browse the repository at this point in the history
  • Loading branch information
krisleech committed Feb 24, 2012
2 parents dc53a2b + ba2f755 commit 5582cb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions app/controllers/documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ def index
end

def show
path = request.path == '/' ? '/home' : request.path
path = permalink_path || home_path || request.path
@document = Document.public.find_by_permalink!(path)
prepare_view_environment
render locate_template(@document)
end

private

def prepare_view_environment
# e.g @blog
instance_variable_set("@#{@document.node_name}", @document)
Expand Down Expand Up @@ -66,4 +66,12 @@ def locate_template(document)
end
raise NoTemplateFound
end

def permalink_path
params[:permalink].present? ? '/' + params[:permalink] : nil
end

def home_path
request.path == '/' ? '/home' : nil
end
end
2 changes: 1 addition & 1 deletion lib/qwerty/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Qwerty
VERSION = "0.0.4.pre"
VERSION = "0.0.5.pre"
end

0 comments on commit 5582cb0

Please sign in to comment.