Added parent-child relationship to pages to visualize a breadcrump and subpages.
This commit is contained in:
parent
00619ccf55
commit
a8c93c08b7
24 changed files with 513 additions and 51 deletions
|
|
@ -1,7 +1,11 @@
|
|||
class Wikilink < WikiCloth::WikiLinkHandler
|
||||
|
||||
def url_for(page)
|
||||
"/wiki/#{page}"
|
||||
def url_for(page, parent = nil)
|
||||
if parent
|
||||
"/pages/new?title=#{page}&parent=#{parent}"
|
||||
else
|
||||
"/wiki/#{page}"
|
||||
end
|
||||
end
|
||||
|
||||
def link_attributes_for(page)
|
||||
|
|
@ -9,7 +13,7 @@ class Wikilink < WikiCloth::WikiLinkHandler
|
|||
if Page.exists?(:permalink => permalink)
|
||||
{ :href => url_for(permalink) }
|
||||
else
|
||||
{ :href => url_for(page), :class => "new_wiki_link"}
|
||||
{ :href => url_for(page, params[:referer]), :class => "new_wiki_link"}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue