summaryrefslogtreecommitdiffstats
path: root/app/controllers/boards_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-24 16:51:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-24 16:51:07 +0000
commita7e32302a6c91c56e6511d1a44a64db07f53221d (patch)
treeae67ac4c2683b08b2b993dab23a6976c09bd0272 /app/controllers/boards_controller.rb
parent6385217be04b2468f25e12700a39a3c6c6f0f832 (diff)
downloadredmine-a7e32302a6c91c56e6511d1a44a64db07f53221d.tar.gz
redmine-a7e32302a6c91c56e6511d1a44a64db07f53221d.zip
Adds single forum atom feed (#3181).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2682 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/boards_controller.rb')
-rw-r--r--app/controllers/boards_controller.rb36
1 files changed, 23 insertions, 13 deletions
diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb
index 8d53f81e4..eaac14e5b 100644
--- a/app/controllers/boards_controller.rb
+++ b/app/controllers/boards_controller.rb
@@ -35,19 +35,29 @@ class BoardsController < ApplicationController
end
def show
- sort_init 'updated_on', 'desc'
- sort_update 'created_on' => "#{Message.table_name}.created_on",
- 'replies' => "#{Message.table_name}.replies_count",
- 'updated_on' => "#{Message.table_name}.updated_on"
-
- @topic_count = @board.topics.count
- @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page']
- @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '),
- :include => [:author, {:last_reply => :author}],
- :limit => @topic_pages.items_per_page,
- :offset => @topic_pages.current.offset
- @message = Message.new
- render :action => 'show', :layout => !request.xhr?
+ respond_to do |format|
+ format.html {
+ sort_init 'updated_on', 'desc'
+ sort_update 'created_on' => "#{Message.table_name}.created_on",
+ 'replies' => "#{Message.table_name}.replies_count",
+ 'updated_on' => "#{Message.table_name}.updated_on"
+
+ @topic_count = @board.topics.count
+ @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page']
+ @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '),
+ :include => [:author, {:last_reply => :author}],
+ :limit => @topic_pages.items_per_page,
+ :offset => @topic_pages.current.offset
+ @message = Message.new
+ render :action => 'show', :layout => !request.xhr?
+ }
+ format.atom {
+ @messages = @board.messages.find :all, :order => 'created_on DESC',
+ :include => [:author, :board],
+ :limit => Setting.feeds_limit.to_i
+ render_feed(@messages, :title => "#{@project}: #{@board}")
+ }
+ end
end
verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index }