summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb20
-rw-r--r--app/models/wiki_page.rb6
-rw-r--r--app/views/projects/activity.rhtml8
3 files changed, 31 insertions, 3 deletions
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)%><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_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 class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
<% end %>
@@ -35,6 +36,9 @@
<i><%= e.author.name %></i>
<% 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 />
+ <% 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 %>
</p></li>
@@ -56,4 +60,4 @@
%>&nbsp;
</div>
<br />
-</div> \ No newline at end of file
+</div>