Wiki Redirects and Page Renaming
Added the ability to rename existing pages. [[!redirects Some Page Name]] redirects Wikilinks [[Some Page Name]] to the current page (assuming "Some Page Name" does not exist). Real pages trump redirects (though this may change, depending on user feedback).
This commit is contained in:
parent
634f635f16
commit
d7832ba262
16 changed files with 161 additions and 33 deletions
|
@ -129,7 +129,7 @@ class FileController < ApplicationController
|
|||
next
|
||||
else
|
||||
logger.info "Page '#{page_name}' already exists. Adding a new revision to it."
|
||||
wiki.revise_page(@web.address, page_name, page_content, Time.now, @author, PageRenderer.new)
|
||||
wiki.revise_page(@web.address, page_name, page_name, page_content, Time.now, @author, PageRenderer.new)
|
||||
end
|
||||
else
|
||||
wiki.write_page(@web.address, page_name, page_content, Time.now, @author, PageRenderer.new)
|
||||
|
|
|
@ -22,8 +22,9 @@ class RevisionSweeper < ActionController::Caching::Sweeper
|
|||
|
||||
def expire_caches(page)
|
||||
expire_cached_summary_pages(page.web)
|
||||
pages_to_expire = ([page.name] + WikiReference.pages_that_reference(page.web, page.name) +
|
||||
WikiReference.pages_that_include(page.web, page.name)).uniq
|
||||
pages_to_expire = ([page.name] + WikiReference.pages_that_reference(page.web, page.name)
|
||||
+ WikiReference.pages_redirected_to(page.web, page.name)
|
||||
+ WikiReference.pages_that_include(page.web, page.name)).uniq
|
||||
pages_to_expire.each { |page_name| expire_cached_page(page.web, page_name) }
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class WebSweeper < ActionController::Caching::Sweeper
|
|||
web.pages.each { |page| expire_cached_page(web, page.name) }
|
||||
expire_cached_summary_pages(web)
|
||||
elsif record.is_a?(WikiFile)
|
||||
record.web.pages_that_link_to(record.file_name).each do |page|
|
||||
record.web.pages_that_link_to_file(record.file_name).each do |page|
|
||||
expire_cached_page(record.web, page)
|
||||
end
|
||||
expire_cached_summary_pages(record.web)
|
||||
|
|
|
@ -268,9 +268,13 @@ class WikiController < ApplicationController
|
|||
raise Instiki::ValidationError.new('Your content was not valid utf-8.')
|
||||
end
|
||||
if @page
|
||||
wiki.revise_page(@web_name, @page_name, the_content, Time.now,
|
||||
new_name = params['new_name'] || @page_name
|
||||
raise Instiki::ValidationError.new('Your new title was not valid utf-8.') unless new_name.is_utf8?
|
||||
raise Instiki::ValidationError.new('A page named "' + new_name.escapeHTML + '" already exists.') if @page_name != new_name && @web.has_page?(new_name)
|
||||
wiki.revise_page(@web_name, @page_name, new_name, the_content, Time.now,
|
||||
Author.new(author_name, remote_ip), PageRenderer.new)
|
||||
@page.unlock
|
||||
@page_name = new_name
|
||||
else
|
||||
wiki.write_page(@web_name, @page_name, the_content, Time.now,
|
||||
Author.new(author_name, remote_ip), PageRenderer.new)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue