From 21f7693c06c3728fdd208b1807d28d70bdc29be7 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sat, 5 Feb 2005 16:36:27 +0000 Subject: [PATCH] Fixed links to Wiki pages with slashes and other interesting characters in the name --- app/models/page.rb | 3 +++ app/views/wiki/edit.rhtml | 4 ++-- app/views/wiki/list.rhtml | 4 ++-- app/views/wiki/locked.rhtml | 4 ++-- app/views/wiki/page.rhtml | 10 +++++----- app/views/wiki/recently_revised.rhtml | 2 +- app/views/wiki/revision.rhtml | 10 +++++----- app/views/wiki/rollback.rhtml | 4 ++-- app/views/wiki/rss_feed.rhtml | 4 ++-- app/views/wiki/search.rhtml | 4 ++-- test/functional/wiki_controller_test.rb | 2 +- 11 files changed, 27 insertions(+), 24 deletions(-) diff --git a/app/models/page.rb b/app/models/page.rb index 84deefa0..1f714101 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -85,6 +85,9 @@ class Page @web.make_link(author, nil, options) end + def url + CGI.escape(self.name) + end private diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 909918e9..386676f0 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -8,7 +8,7 @@ <%= render("#{@web.markup}_help") if @web %> -
+

@@ -16,7 +16,7 @@ as - | Cancel (unlocks page) + | Cancel (unlocks page)

diff --git a/app/views/wiki/list.rhtml b/app/views/wiki/list.rhtml index 77a09b85..dddd499a 100644 --- a/app/views/wiki/list.rhtml +++ b/app/views/wiki/list.rhtml @@ -17,7 +17,7 @@ <% end %> <% if @web.count_pages %> @@ -51,7 +51,7 @@ <% end %> diff --git a/app/views/wiki/locked.rhtml b/app/views/wiki/locked.rhtml index e3590afd..c878233f 100644 --- a/app/views/wiki/locked.rhtml +++ b/app/views/wiki/locked.rhtml @@ -8,12 +8,12 @@

<%= link_to 'Edit the page anyway', - {:web => @web_name, :action => 'edit', :id => @page.name, :params => {'break_lock' => '1'} }, + {:web => @web_name, :action => 'edit', :id => @page.url, :params => {'break_lock' => '1'} }, {:accesskey => 'E'} %> <%= link_to 'Cancel', - {:web => @web_name, :action => 'show', :id => @page.name}, + {:web => @web_name, :action => 'show', :id => @page.url}, {:accesskey => 'C'} %> diff --git a/app/views/wiki/page.rhtml b/app/views/wiki/page.rhtml index b8cb46f8..cbccc582 100644 --- a/app/views/wiki/page.rhtml +++ b/app/views/wiki/page.rhtml @@ -27,14 +27,14 @@