-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
redmine_recent_wiki_pages | ||
========================= | ||
|
||
Displays a list of recently updated wiki pages across all projects | ||
Adds a "Recent Wiki Pages" block to be used for /my/page, which displays a list | ||
of recently updated wiki pages across all projects. | ||
|
||
Tested against Redmine 2.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class RecentWikiPagesController < ApplicationController | ||
def date_index | ||
@pages = WikiPage.find :all, | ||
:select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", | ||
:joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id", | ||
:order => "#{WikiContent.table_name}.updated_on DESC" | ||
@pages_by_date = @pages.group_by {|p| p.updated_on.to_date} | ||
@pages_by_parent_id = @pages.group_by(&:parent_id) | ||
|
||
@pages.first.wiki | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module RecentWikiPagesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<% | ||
#see WikiController::load_pages_for_index | ||
pages = WikiPage.with_updated_on.find :all, :order => "updated_on DESC", :limit => 10,:include => {:wiki => :project} | ||
%> | ||
|
||
<span style="display:inline-block"> <h3>Top 10 Most Recent Wiki Pages</h3></span> | ||
<span style="display:inline-block"> <%=link_to("more", {:controller => 'recent_wiki_pages', :action => 'date_index' }) %></span> | ||
|
||
<table class="list issues"> | ||
<thead> | ||
<tr> | ||
<th>Page</th><th>Project</th><th>Updated On</th><th>Author</th> | ||
</tr> | ||
</thead> | ||
<% i=0 %> | ||
<% pages[0,10].each do |page| %> | ||
<% | ||
if i % 2 == 0 | ||
trclass = "even" | ||
else | ||
trclass = "odd" | ||
end | ||
%> | ||
<tr class="<%=trclass%>"> | ||
<td> | ||
<%=link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :id=> page.title}) %> | ||
</td> | ||
<td> | ||
<%=link_to(h(page.project), {:controller => 'wiki', :action => 'date_index', :project_id => page.project }) %> | ||
</td> | ||
<td> | ||
<%= page.content.updated_on.strftime("%I:%M%p %Y-%m-%d") %> | ||
</td> | ||
<td> | ||
<%= page.content.author %> | ||
</td> | ||
</tr> | ||
<% i += 1 %> | ||
<% end %> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h2>Recently modified pages</h2> | ||
|
||
<% if @pages.empty? %> | ||
<p class="nodata"><%= l(:label_no_data) %></p> | ||
<% end %> | ||
<% @pages_by_date.keys.sort.reverse.each do |date| %> | ||
<h3><%= format_date(date) %></h3> | ||
<ul> | ||
<% @pages_by_date[date].each do |page| %> | ||
<li><%= link_to page.pretty_title, :action => 'show', :id => page.title, :project_id => page.project, :controller => 'wiki' %> (<%=link_to(h(page.project), {:controller => 'wiki', :action => 'date_index', :project_id => page.project }) %>) by <%= page.content.author %> on <%= page.content.updated_on.strftime("%I:%M%p %Y-%m-%d") %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
match 'recent_wiki_pages/date_index', :controller => 'recent_wiki_pages', :action => 'date_index', :via => [:get] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'redmine' | ||
|
||
# require_dependency "welcome_controller_patch" | ||
|
||
Redmine::Plugin.register :redmine_recent_wiki_pages do | ||
name 'Redmine Recent Wiki Pages' | ||
author 'Alex Dergachev' | ||
url 'https://github.com/evolvingweb/redmine_recent_wiki_pages' | ||
author_url 'http://evolvingweb.ca' | ||
description 'Displays a list of recently updated wiki pages across all projects' | ||
version '0.0.1' | ||
end |