Fix problem in breadcrumps, when no "Home"-page exists.
This commit is contained in:
parent
42b5e7a73f
commit
47d3232e4e
6 changed files with 21 additions and 5 deletions
|
|
@ -20,6 +20,22 @@ module PagesHelper
|
|||
link_to text, "/wiki/#{page.title}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def link_to_wikipage_by_permalink(permalink, text = nil)
|
||||
unless permalink.blank?
|
||||
page = Page.find_by_permalink(permalink)
|
||||
if page.nil?
|
||||
if text.nil?
|
||||
link_to permalink, new_page_path(:title => permalink)
|
||||
else
|
||||
link_to text, new_page_path(:title => permalink)
|
||||
end
|
||||
else
|
||||
link_to_wikipage(page, text)
|
||||
end
|
||||
end
|
||||
end
|
||||
# def generate_toc(body)
|
||||
# toc = ""
|
||||
# body.gsub(/^([=]{1,6})\s*(.*?)\s*(\1)/) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue