patch #9429 Display Wiki edits in activity log (Nick Read)

git-svn-id: http://redmine.rubyforge.org/svn/trunk@370 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-03-23 15:58:02 +00:00
parent 76d4ac17a2
commit 724ca74f51
9 changed files with 43 additions and 3 deletions

View File

@ -499,6 +499,26 @@ class ProjectsController < ApplicationController
@show_documents = 1 @show_documents = 1
end 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? render :layout => false if request.xhr?
end end

View File

@ -29,6 +29,10 @@ class WikiPage < ActiveRecord::Base
end end
def pretty_title 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
end end

View File

@ -9,7 +9,8 @@
<%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%><br /> <%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%><br />
<%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%><br /> <%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%><br />
<%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%><br /> <%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%><br />
<%= 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)%><br />
<%= check_box_tag 'show_wiki_edits', 1, @show_wiki_edits %><%= hidden_field_tag 'show_wiki_edits', 0, :id => nil %> <%=l(:label_wiki_edit_plural)%>
</p> </p>
<p class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p> <p class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
<% end %> <% end %>
@ -35,6 +36,9 @@
<i><%= e.author.name %></i> <i><%= e.author.name %></i>
<% elsif e.is_a? Document %> <% 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 %><br /> <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %><br />
<% 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 %>)<br />
<% unless e.comment.blank? %><em><%=h e.comment %></em><% end %>
<% end %> <% end %>
</p></li> </p></li>
@ -56,4 +60,4 @@
%>&nbsp; %>&nbsp;
</div> </div>
<br /> <br />
</div> </div>

View File

@ -328,6 +328,8 @@ label_result: %d Resultat
label_result_plural: %d Resultate label_result_plural: %d Resultate
label_all_words: Alle Wörter label_all_words: Alle Wörter
label_wiki: Wiki label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_page_index: Index label_page_index: Index
label_current_version: Gegenwärtige Version label_current_version: Gegenwärtige Version
label_preview: Preview label_preview: Preview

View File

@ -328,6 +328,8 @@ label_result: %d result
label_result_plural: %d results label_result_plural: %d results
label_all_words: All words label_all_words: All words
label_wiki: Wiki label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_page_index: Index label_page_index: Index
label_current_version: Current version label_current_version: Current version
label_preview: Preview label_preview: Preview

View File

@ -328,6 +328,8 @@ label_result: %d resultado
label_result_plural: %d resultados label_result_plural: %d resultados
label_all_words: Todas las palabras label_all_words: Todas las palabras
label_wiki: Wiki label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_page_index: Índice label_page_index: Índice
label_current_version: Versión actual label_current_version: Versión actual
label_preview: Previo label_preview: Previo

View File

@ -328,6 +328,8 @@ label_result: %d résultat
label_result_plural: %d résultats label_result_plural: %d résultats
label_all_words: Tous les mots label_all_words: Tous les mots
label_wiki: Wiki label_wiki: Wiki
label_wiki_edit: Révision wiki
label_wiki_edit_plural: Révisions wiki
label_page_index: Index label_page_index: Index
label_current_version: Version actuelle label_current_version: Version actuelle
label_preview: Prévisualisation label_preview: Prévisualisation

View File

@ -328,6 +328,8 @@ label_result: %d risultato
label_result_plural: %d risultati label_result_plural: %d risultati
label_all_words: Tutte le parole label_all_words: Tutte le parole
label_wiki: Wiki label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_page_index: Indice label_page_index: Indice
label_current_version: Versione corrente label_current_version: Versione corrente
label_preview: Previsione label_preview: Previsione

View File

@ -329,6 +329,8 @@ label_result: %d 件の結果
label_result_plural: %d 件の結果 label_result_plural: %d 件の結果
label_all_words: すべての単語 label_all_words: すべての単語
label_wiki: Wiki label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_page_index: 索引 label_page_index: 索引
label_current_version: 最近版 label_current_version: 最近版
label_preview: 下検分 label_preview: 下検分