diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 2792d783..46a931c2 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -49,10 +49,6 @@ class WikiController < ApplicationController @authors = @page_names_by_author.keys.sort end - def changes - raise "Not implemented yet" - end - def export_html stylesheet = File.read(File.join(RAILS_ROOT, 'public', 'stylesheets', 'instiki.css')) export_pages_as_zip('html') do |page| @@ -212,6 +208,7 @@ class WikiController < ApplicationController def revision get_page_and_revision + @show_diff = (@params[:mode] == 'diff') @renderer = PageRenderer.new(@revision) end @@ -250,6 +247,7 @@ class WikiController < ApplicationController if @page begin @renderer = PageRenderer.new(@page.revisions.last) + @show_diff = (@params[:mode] == 'diff') render_action 'page' # TODO this rescue should differentiate between errors due to rendering and errors in # the application itself (for application errors, it's better not to rescue the error at all) diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index bd357488..67b85e06 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -5,12 +5,13 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <% if @page and (@page.name == 'HomePage') and (%w( show published print ).include?(@action_name)) %> - <%= @web.name %> + <%= h @web.name %> <% elsif @web %> - <%= @title %> in <%= @web.name %> + <%= @title %> in <%= h @web.name %> <% else %> <%= @title %> <% end %> + <%= @show_diff ? ' (changes)' : '' %> @@ -42,7 +43,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<% if @page and (@page.name == 'HomePage') and %w( show published print ).include?(@action_name) %> - <%= @web.name %> + <%= h(@web.name) + (@show_diff ? ' (changes)' : '') %> <% elsif @web %> <%= @web.name %>
<%= @title %> diff --git a/app/views/wiki/page.rhtml b/app/views/wiki/page.rhtml index 65d9d8be..169460fe 100644 --- a/app/views/wiki/page.rhtml +++ b/app/views/wiki/page.rhtml @@ -1,10 +1,11 @@ <% - @title = @page.plain_name + @title = @page.plain_name + @title += ' (changes)' if @show_diff @show_footer = true %>
- <%= @renderer.display_content %> + <%= @show_diff ? @renderer.display_diff : @renderer.display_content %>