diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 8feb5f5de..129355851 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -499,6 +499,26 @@ class ProjectsController < ApplicationController @show_documents = 1 end + unless params[:show_wiki_edits] == "0" + select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comment, " + + "#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title" + joins = "LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{WikiContent.versioned_table_name}.page_id " + + "LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " + conditions = ["#{Wiki.table_name}.project_id = ? AND #{WikiContent.versioned_table_name}.updated_on BETWEEN ? AND ?", + @project.id, @date_from, @date_to] + + WikiContent.versioned_class.find(:all, :select => select, :joins => joins, :conditions => conditions).each { |i| + # We provide this alias so all events can be treated in the same manner + def i.created_on + self.updated_on + end + + @events_by_day[i.created_on.to_date] ||= [] + @events_by_day[i.created_on.to_date] << i + } + @show_wiki_edits = 1 + end + render :layout => false if request.xhr? end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index e99bb314e..19961cb0b 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -29,6 +29,10 @@ class WikiPage < ActiveRecord::Base end def pretty_title - title.tr '_', ' ' + WikiPage.pretty_title(title) + end + + def self.pretty_title(str) + (str && str.is_a?(String)) ? str.tr('_', ' ') : str end end diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index 80386b9e1..b1d131aa9 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -9,7 +9,8 @@ <%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%>
<%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%>
<%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%>
- <%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%> + <%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%>
+ <%= check_box_tag 'show_wiki_edits', 1, @show_wiki_edits %><%= hidden_field_tag 'show_wiki_edits', 0, :id => nil %> <%=l(:label_wiki_edit_plural)%>

<%= submit_tag l(:button_apply), :class => 'button-small' %>

<% end %> @@ -35,6 +36,9 @@ <%= e.author.name %> <% elsif e.is_a? Document %> <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %>
+ <% elsif e.is_a? WikiContent.versioned_class %> + <%= e.created_on.strftime("%H:%M") %> <%=l(:label_wiki_edit)%>: <%= link_to h(WikiPage.pretty_title(e.title)), :controller => 'wiki', :page => e.title %> (<%= link_to '#' + e.version.to_s, :controller => 'wiki', :page => e.title, :version => e.version %>)
+ <% unless e.comment.blank? %><%=h e.comment %><% end %> <% end %>

@@ -56,4 +60,4 @@ %> 
- \ No newline at end of file + diff --git a/lang/de.yml b/lang/de.yml index 4cd6eab51..9bd293559 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -328,6 +328,8 @@ label_result: %d Resultat label_result_plural: %d Resultate label_all_words: Alle Wörter label_wiki: Wiki +label_wiki_edit: Wiki edit +label_wiki_edit_plural: Wiki edits label_page_index: Index label_current_version: Gegenwärtige Version label_preview: Preview diff --git a/lang/en.yml b/lang/en.yml index 00519ec53..72f75597b 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -328,6 +328,8 @@ label_result: %d result label_result_plural: %d results label_all_words: All words label_wiki: Wiki +label_wiki_edit: Wiki edit +label_wiki_edit_plural: Wiki edits label_page_index: Index label_current_version: Current version label_preview: Preview diff --git a/lang/es.yml b/lang/es.yml index 13c32bf1d..a8eb1d0d3 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -328,6 +328,8 @@ label_result: %d resultado label_result_plural: %d resultados label_all_words: Todas las palabras label_wiki: Wiki +label_wiki_edit: Wiki edit +label_wiki_edit_plural: Wiki edits label_page_index: Índice label_current_version: Versión actual label_preview: Previo diff --git a/lang/fr.yml b/lang/fr.yml index c113301d3..dbce4b0c7 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -328,6 +328,8 @@ label_result: %d résultat label_result_plural: %d résultats label_all_words: Tous les mots label_wiki: Wiki +label_wiki_edit: Révision wiki +label_wiki_edit_plural: Révisions wiki label_page_index: Index label_current_version: Version actuelle label_preview: Prévisualisation diff --git a/lang/it.yml b/lang/it.yml index 9bab4c9b7..e6316e0dd 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -328,6 +328,8 @@ label_result: %d risultato label_result_plural: %d risultati label_all_words: Tutte le parole label_wiki: Wiki +label_wiki_edit: Wiki edit +label_wiki_edit_plural: Wiki edits label_page_index: Indice label_current_version: Versione corrente label_preview: Previsione diff --git a/lang/ja.yml b/lang/ja.yml index eb0be8825..83e681c0d 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -329,6 +329,8 @@ label_result: %d 件の結果 label_result_plural: %d 件の結果 label_all_words: すべての単語 label_wiki: Wiki +label_wiki_edit: Wiki edit +label_wiki_edit_plural: Wiki edits label_page_index: 索引 label_current_version: 最近版 label_preview: 下検分