Fixed links to Wiki pages with slashes and other interesting characters in the name
This commit is contained in:
parent
5cb21ff619
commit
21f7693c06
|
@ -85,6 +85,9 @@ class Page
|
|||
@web.make_link(author, nil, options)
|
||||
end
|
||||
|
||||
def url
|
||||
CGI.escape(self.name)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<%= render("#{@web.markup}_help") if @web %>
|
||||
|
||||
<form id="editForm" action="../save/<%= @page.name %>" method="post" onSubmit="cleanAuthorName();">
|
||||
<form id="editForm" action="../save/<%= @page.url %>" method="post" onSubmit="cleanAuthorName();">
|
||||
<p>
|
||||
<textarea name="content" style="width: 450px; height: 500px"><%= @page.content %></textarea>
|
||||
</p>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<input type="submit" value="Submit" accesskey="s"/> as
|
||||
<input type="text" name="author" id="authorName" value="<%= @author %>"
|
||||
onClick="this.value == 'AnonymousCoward' ? this.value = '' : true" />
|
||||
| <a href="../cancel_edit/<%= @page.name %>" accesskey="c">Cancel</a> <small>(unlocks page)</small>
|
||||
| <a href="../cancel_edit/<%= @page.url %>" accesskey="c">Cancel</a> <small>(unlocks page)</small>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<% end %>
|
||||
|
||||
<ul><% for page in @pages_by_name %>
|
||||
<li><a href="../show/<%= page.name %>"><%= truncate(page.plain_name, 35) %></a></li>
|
||||
<li><a href="../show/<%= page.url %>"><%= truncate(page.plain_name, 35) %></a></li>
|
||||
<% end %></ul>
|
||||
|
||||
<% if @web.count_pages %>
|
||||
|
@ -51,7 +51,7 @@
|
|||
</h2>
|
||||
|
||||
<ul style="margin-bottom: 35px">
|
||||
<% for page in @pages_that_are_orphaned %><li><a href="../show/<%= page.name %>"><%= truncate(page.plain_name, 35) %></a></li><% end %>
|
||||
<% for page in @pages_that_are_orphaned %><li><a href="../show/<%= page.url %>"><%= truncate(page.plain_name, 35) %></a></li><% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
<p>
|
||||
<%= 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'}
|
||||
%>
|
||||
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
|
||||
<div class="navigation">
|
||||
<% if @page.name == "HomePage" %>
|
||||
<a href="../edit/<%= @page.name %>" class="navlink" accesskey="E">Edit Page</a>
|
||||
<a href="../edit/<%= @page.url %>" class="navlink" accesskey="E">Edit Page</a>
|
||||
| <a href="../edit_web" class="navlink">Edit Web</a>
|
||||
<% else %>
|
||||
<a href="../edit/<%= @page.name %>" class="navlink" accesskey="E">Edit</a>
|
||||
<a href="../edit/<%= @page.url %>" class="navlink" accesskey="E">Edit</a>
|
||||
<% end %>
|
||||
|
||||
<% if @page.revisions.length > 1 %>
|
||||
| <a href="../revision/<%= @page.name %>?rev=<%= @page.revisions.length - 2 %>" class="navlink" accesskey="R">Back in time</a>
|
||||
| <a href="../revision/<%= @page.url %>?rev=<%= @page.revisions.length - 2 %>" class="navlink" accesskey="R">Back in time</a>
|
||||
<small>(<%= @page.revisions.length - 1 %> revisions)</small>
|
||||
<% end %>
|
||||
|
||||
|
@ -48,9 +48,9 @@
|
|||
<% end %>
|
||||
|
||||
<small>
|
||||
| Views: <a href="../print/<%= @page.name %>" accesskey="p">Print</a>
|
||||
| Views: <a href="../print/<%= @page.url %>" accesskey="p">Print</a>
|
||||
<% if defined? RedClothForTex and RedClothForTex.available? and @web.markup == :textile %>
|
||||
| <a href="../tex/<%= @page.name %>">TeX</a> | <a href="../pdf/<%= @page.name %>">PDF</a>
|
||||
| <a href="../tex/<%= @page.url %>">TeX</a> | <a href="../pdf/<%= @page.url %>">PDF</a>
|
||||
<% end %>
|
||||
</small>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<ul>
|
||||
<% end %>
|
||||
<li>
|
||||
<a href="../show/<%= page.name %>"><%= page.plain_name %></a>
|
||||
<a href="../show/<%= page.url %>"><%= page.plain_name %></a>
|
||||
<div class="byline" style="margin-bottom: 0px">
|
||||
by <%= page.author_link %>
|
||||
at <%= page.created_at.strftime "%H:%M" %>
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
<% if @revision.next_revision %>
|
||||
<% if @revision.next_revision.number < (@page.revisions.length - 1) %>
|
||||
<a href="../revision/<%= @page.name %>?rev=<%= @revision.next_revision.number %>" class="navlink">
|
||||
<a href="../revision/<%= @page.url %>?rev=<%= @revision.next_revision.number %>" class="navlink">
|
||||
<% else %>
|
||||
<a href="../show/<%= @page.name %>" class="navlink">
|
||||
<a href="../show/<%= @page.url %>" class="navlink">
|
||||
<% end %>
|
||||
Forward in time</a>
|
||||
(<%= @revision.page.revisions.length - @revision.next_revision.number %> more)
|
||||
|
@ -38,11 +38,11 @@
|
|||
<% end %>
|
||||
|
||||
<% if @revision.previous_revision %>
|
||||
<a href="../revision/<%= @page.name %>?rev=<%= @revision.previous_revision.number %>" class="navlink">Back in time</a>
|
||||
<a href="../revision/<%= @page.url %>?rev=<%= @revision.previous_revision.number %>" class="navlink">Back in time</a>
|
||||
(<%= @revision.previous_revision.number + 1 %> more)
|
||||
<% end %>
|
||||
|
||||
| <a href="../show/<%= @page.name %>" class="navlink">See current</a>
|
||||
| <a href="../show/<%= @page.url %>" class="navlink">See current</a>
|
||||
|
||||
<% if @revision.previous_revision %>
|
||||
<span id="show_changes">
|
||||
|
@ -53,7 +53,7 @@
|
|||
</span>
|
||||
<% end %>
|
||||
|
||||
| <a href="../rollback/<%= @page.name %>?rev=<%= @revision.number %>" class="navlink">Rollback</a>
|
||||
| <a href="../rollback/<%= @page.url %>?rev=<%= @revision.number %>" class="navlink">Rollback</a>
|
||||
|
||||
<% if @page.references.length > 0 %>
|
||||
<small>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<%= "<p style='color:red'>Please correct the error that caused this error in rendering:<br/><small>#{@params["msg"]}</small></p>" if @params["msg"] %>
|
||||
|
||||
<form id="editForm" action="../save/<%= @page.name %>" method="post" onSubmit="cleanAuthorName();">
|
||||
<form id="editForm" action="../save/<%= @page.url %>" method="post" onSubmit="cleanAuthorName();">
|
||||
<p>
|
||||
<textarea name="content" style="font-size: 12px; width: 450px; height: 500px"><%= @revision.content %></textarea>
|
||||
</p>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<input type="submit" value="Update"> as
|
||||
<input type="text" name="author" id="authorName" value="<%= @author %>"
|
||||
onClick="this.value == 'AnonymousCoward' ? this.value = '' : true">
|
||||
| <a href="../cancel_edit/<%= @page.name %>">Cancel</a> <small>(unlocks page)</small>
|
||||
| <a href="../cancel_edit/<%= @page.url %>">Cancel</a> <small>(unlocks page)</small>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<description><%= CGI.escapeHTML(page.display_content) %></description>
|
||||
<% end %>
|
||||
<pubDate><%= page.created_at.strftime "%a, %e %b %Y %H:%M:%S %Z" %></pubDate>
|
||||
<guid><%= url_for :only_path => false, :web => @web_name, :action => 'show', :id => page.name %></guid>
|
||||
<link><%= url_for :only_path => false, :web => @web_name, :action => 'show', :id => page.name %></link>
|
||||
<guid><%= url_for :only_path => false, :web => @web_name, :action => 'show', :id => page.url %></guid>
|
||||
<link><%= url_for :only_path => false, :web => @web_name, :action => 'show', :id => page.url %></link>
|
||||
<dc:creator><%= WikiWords.separate(page.author) %></dc:creator>
|
||||
</item>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<h2><%= @title_results.length %> page(s) containing search string in the page name:</h2>
|
||||
<ul>
|
||||
<% for page in @title_results %>
|
||||
<li><a href="../show/<%= page.name %>"><%= page.plain_name %></a></li>
|
||||
<li><a href="../show/<%= page.url %>"><%= page.plain_name %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<h2> <%= @results.length %> page(s) containing search string in the page text:</h2>
|
||||
<ul>
|
||||
<% for page in @results %>
|
||||
<li><a href="../show/<%= page.name %>"><%= page.plain_name %></a></li>
|
||||
<li><a href="../show/<%= page.url %>"><%= page.plain_name %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
|
@ -409,7 +409,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
|||
['http://localhost:8080/wiki1/show/HomePage',
|
||||
'http://localhost:8080/wiki1/show/Oak',
|
||||
'http://localhost:8080/wiki1/show/Elephant',
|
||||
'http://localhost:8080/wiki1/show/Title With Spaces']
|
||||
'http://localhost:8080/wiki1/show/Title+With+Spaces']
|
||||
|
||||
assert_template_xpath_match '/rss/channel/link',
|
||||
'http://localhost:8080/wiki1/show/HomePage'
|
||||
|
|
Loading…
Reference in a new issue