From 5e20417e6d523372320861f1d9a446ddd75e041f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 14 Jul 2007 11:25:03 +0000 Subject: Added wiki diff. Diff can be viewed from the page history, or directly from the project activity page for each edit. Uses Lars Christensen's diff library. git-svn-id: http://redmine.rubyforge.org/svn/trunk@583 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/wiki/diff.rhtml | 19 +++++++++++++++++++ app/views/wiki/history.rhtml | 17 ++++++++++++----- app/views/wiki/show.rhtml | 3 ++- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 app/views/wiki/diff.rhtml (limited to 'app/views/wiki') diff --git a/app/views/wiki/diff.rhtml b/app/views/wiki/diff.rhtml new file mode 100644 index 000000000..8db2df008 --- /dev/null +++ b/app/views/wiki/diff.rhtml @@ -0,0 +1,19 @@ +
+<%= link_to(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit') %> +<%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %> +<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %> +
+ +

<%= @page.pretty_title %>

+ +

+<%= l(:label_version) %> <%= link_to @diff.content_from.version, :action => 'index', :page => @page.title, :version => @diff.content_from.version %> +(<%= @diff.content_from.author ? @diff.content_from.author.name : "anonyme" %>, <%= format_time(@diff.content_from.updated_on) %>) +→ +<%= l(:label_version) %> <%= link_to @diff.content_to.version, :action => 'index', :page => @page.title, :version => @diff.content_to.version %>/<%= @page.content.version %> +(<%= @diff.content_to.author ? @diff.content_to.author.name : "anonyme" %>, <%= format_time(@diff.content_to.updated_on) %>) +

+ +
+ +<%= html_diff(@diff) %> diff --git a/app/views/wiki/history.rhtml b/app/views/wiki/history.rhtml index 6040072ea..85b1541cc 100644 --- a/app/views/wiki/history.rhtml +++ b/app/views/wiki/history.rhtml @@ -6,26 +6,33 @@

<%= l(:label_history) %>

+<% form_tag({:action => "diff"}, :method => :get) do %> + + +<% show_diff = @versions.size > 1 %> +<% line_num = 1 %> <% @versions.each do |ver| %> "> + + +<% line_num += 1 %> <% end %>
# <%= l(:field_updated_on) %> <%= l(:field_author) %> <%= l(:field_comments) %>
<%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < @versions.size) %><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true || $('version_from').value > #{ver.version}) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %> <%= format_time(ver.updated_on) %> <%= ver.author ? ver.author.name : "anonyme" %> <%=h ver.comments %>
- -

<%= pagination_links_full @version_pages, :page_param => :p %> -[ <%= @version_pages.current.first_item %> - <%= @version_pages.current.last_item %> / <%= @version_count %> ]

- -

<%= link_to l(:button_back), :action => 'index', :page => @page.title %>

+<%= submit_tag l(:label_view_diff), :class => 'small' %> +<%= pagination_links_full @version_pages, :page_param => :p %> +[ <%= @version_pages.current.first_item %> - <%= @version_pages.current.last_item %> / <%= @version_count %> ] +<% end %> diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index 3a830a47d..c7a2985be 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -9,7 +9,8 @@ <% if @content.version != @page.content.version %>

<%= link_to(('« ' + l(:label_previous)), :action => 'index', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> - <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> - + <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> + <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :page => @page.title, :version => @content.version) + ')' if @content.version > 1 %> - <%= link_to((l(:label_next) + ' »'), :action => 'index', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %>
-- cgit v1.2.3