Fixed links to author pages on wiki/revised_pages

This commit is contained in:
Alexey Verkhovsky 2005-04-03 06:34:15 +00:00
parent 1038c2b373
commit 449a7fb8f3
2 changed files with 4 additions and 3 deletions

View file

@ -45,7 +45,7 @@ module ApplicationHelper
# Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet # Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet
def link_to_page(page_name, web = @web, text = nil, options = {}) def link_to_page(page_name, web = @web, text = nil, options = {})
raise 'Web not defined' if web.nil? raise 'Web not defined' if web.nil?
home_page_url = url_for :web => web.address, :action => 'show', :id => page_name, :only_path => true home_page_url = url_for :web => web.address, :action => 'show', :id => 'HomePage', :only_path => true
base_url = home_page_url.sub(%r-/show/HomePage/?$-, '') base_url = home_page_url.sub(%r-/show/HomePage/?$-, '')
web.make_link(page_name, text, options.merge(:base_url => base_url)) web.make_link(page_name, text, options.merge(:base_url => base_url))
end end

View file

@ -20,9 +20,9 @@
<ul> <ul>
<% end %> <% end %>
<li> <li>
<%= link_to page.name, :web => @web.address, :action => 'show', :id => page.name %> <%= link_to_existing_page page %>
<div class="byline" style="margin-bottom: 0px"> <div class="byline" style="margin-bottom: 0px">
by <%= page.author_link %> by <%= link_to_page(page.author) %>
at <%= page.created_at.strftime "%H:%M" %> at <%= page.created_at.strftime "%H:%M" %>
<%= "from #{page.author.ip}" if page.author.respond_to?(:ip) %> <%= "from #{page.author.ip}" if page.author.respond_to?(:ip) %>
</div> </div>
@ -30,3 +30,4 @@
<% end %> <% end %>
</ul> </ul>
<% end %> <% end %>