diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index d4bc834..f4436f8 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -3,10 +3,14 @@ class ContentViewerController < PublicController needs_profile def view_page - path = params[:page].clone - path.unshift(params[:profile]) - @path = path.join('/') - @page = Article.find_by_path(@path) + path = params[:page].join('/') + + if path.blank? + @page = profile.home_page + else + @page = profile.articles.find_by_path(path) + end + if @page.nil? render_not_found(@path) end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3de6579..b728c30 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -105,9 +105,8 @@ module ApplicationHelper def link_to_document(doc, text = nil) text ||= doc.title - path = doc.full_path.split(/\//) - profile = path.shift - link_to text, homepage_path(:profile => profile , :page => path) + path = doc.path.split(/\//) + link_to text, homepage_path(:profile => doc.profile.identifier , :page => path) end # TODO: add the actual links diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index 85e8983..23c2919 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -1,6 +1,6 @@ -