Make Interweb Links Work Right

Links to a published web should be to the 'publish' action, not to the
'show' action. Previously, the published status of the source, not the target
was used.

Also, correct display of the Navigation Links for the 'published' action.
This commit is contained in:
Jacques Distler 2008-12-01 22:58:09 -06:00
parent 11930dfabd
commit 5d47fdff8b
3 changed files with 8 additions and 4 deletions

View file

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title> <title>
<% if @page and (@page.name == 'HomePage') and (%w( show published print ).include?(@action_name)) %> <% if @page and (@page.name == 'HomePage') and (%w( show published print ).include?(params['action'])) %>
<%= h @web.name %> <%= h @web.name %>
<% elsif @web %> <% elsif @web %>
<%= @title %> in <%= h @web.name %> <%= @title %> in <%= h @web.name %>

View file

@ -9,7 +9,7 @@ end
%> %>
<div class="navigation"> <div class="navigation">
<% if @action_name != 'published' then %> <% if params['action'] != 'published' then %>
<%= list_item 'Home Page', {:action => 'show', :id => 'HomePage'}, 'Home, Sweet Home', 'H' %> | <%= list_item 'Home Page', {:action => 'show', :id => 'HomePage'}, 'Home, Sweet Home', 'H' %> |
<%= list_item 'All Pages', {:action => 'list'}, 'Alphabetically sorted list of pages', 'A' %> | <%= list_item 'All Pages', {:action => 'list'}, 'Alphabetically sorted list of pages', 'A' %> |
<%= list_item 'Recently Revised', {:action =>'recently_revised'}, 'Pages sorted by when they were last changed', 'U' %> | <%= list_item 'Recently Revised', {:action =>'recently_revised'}, 'Pages sorted by when they were last changed', 'U' %> |

View file

@ -81,7 +81,9 @@ class UrlGenerator < AbstractUrlGenerator
end end
when :publish when :publish
if known_page if known_page
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'published', web = Web.find_by_address(web_address)
action = web.published? ? 'published' : 'show'
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => action,
:id => name :id => name
%{<a class="existingWikiWord" href="#{href}">#{text}</a>} %{<a class="existingWikiWord" href="#{href}">#{text}</a>}
else else
@ -89,7 +91,9 @@ class UrlGenerator < AbstractUrlGenerator
end end
else else
if known_page if known_page
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'show', web = Web.find_by_address(web_address)
action = web.published? ? 'published' : 'show'
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => action,
:id => name :id => name
%{<a class="existingWikiWord" href="#{href}">#{text}</a>} %{<a class="existingWikiWord" href="#{href}">#{text}</a>}
else else