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}"
|
link_to text, "/wiki/#{page.title}"
|
||||||
end
|
end
|
||||||
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)
|
# def generate_toc(body)
|
||||||
# toc = ""
|
# toc = ""
|
||||||
# body.gsub(/^([=]{1,6})\s*(.*?)\s*(\1)/) do
|
# body.gsub(/^([=]{1,6})\s*(.*?)\s*(\1)/) do
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
.wiki_all
|
.wiki_all
|
||||||
#breadcrump
|
#breadcrump
|
||||||
= link_to_wikipage(Page.find_by_permalink("Home"), "Foodcoop-Wiki")
|
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
|
||||||
|
|
||||||
%h1 Alle Wikiseite
|
%h1 Alle Wikiseite
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
.wiki_edit
|
.wiki_edit
|
||||||
#breadcrump
|
#breadcrump
|
||||||
= link_to_wikipage(Page.find_by_permalink("Home"), "Foodcoop-Wiki")
|
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
|
||||||
- for page in @page.ancestors.reverse
|
- for page in @page.ancestors.reverse
|
||||||
%span.wikiSeparator >
|
%span.wikiSeparator >
|
||||||
= link_to_wikipage(page)
|
= link_to_wikipage(page)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
.wiki_new
|
.wiki_new
|
||||||
#breadcrump
|
#breadcrump
|
||||||
= link_to_wikipage(Page.find_by_permalink("Home"), "Foodcoop-Wiki")
|
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
|
||||||
- parent_page = Page.find_by_permalink(params[:parent])
|
- parent_page = Page.find_by_permalink(params[:parent])
|
||||||
- if parent_page != nil
|
- if parent_page != nil
|
||||||
- for page in parent_page.ancestors.reverse
|
- for page in parent_page.ancestors.reverse
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
.wiki_show
|
.wiki_show
|
||||||
|
|
||||||
#breadcrump
|
#breadcrump
|
||||||
= link_to_wikipage(Page.find_by_permalink("Home"), "Foodcoop-Wiki")
|
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
|
||||||
- for page in @page.ancestors.reverse
|
- for page in @page.ancestors.reverse
|
||||||
%span.wikiSeparator >
|
%span.wikiSeparator >
|
||||||
= link_to_wikipage(page)
|
= link_to_wikipage(page)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
.wiki_version
|
.wiki_version
|
||||||
#breadcrump
|
#breadcrump
|
||||||
= link_to_wikipage(Page.find_by_permalink("Home"), "Foodcoop-Wiki")
|
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
|
||||||
- for page in @page.ancestors.reverse
|
- for page in @page.ancestors.reverse
|
||||||
%span.wikiSeparator >
|
%span.wikiSeparator >
|
||||||
= link_to_wikipage(page)
|
= link_to_wikipage(page)
|
||||||
|
|
Loading…
Reference in a new issue