diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-04-24 16:51:07 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-04-24 16:51:07 +0000 |
commit | a7e32302a6c91c56e6511d1a44a64db07f53221d (patch) | |
tree | ae67ac4c2683b08b2b993dab23a6976c09bd0272 /app | |
parent | 6385217be04b2468f25e12700a39a3c6c6f0f832 (diff) | |
download | redmine-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')
-rw-r--r-- | app/controllers/boards_controller.rb | 36 | ||||
-rw-r--r-- | app/models/board.rb | 4 | ||||
-rw-r--r-- | app/views/boards/show.rhtml | 8 |
3 files changed, 35 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 } diff --git a/app/models/board.rb b/app/models/board.rb index 3bc18efec..ada138375 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -27,6 +27,10 @@ class Board < ActiveRecord::Base validates_length_of :name, :maximum => 30 validates_length_of :description, :maximum => 255 + def to_s + name + end + def reset_counters! self.class.reset_counters!(id) end diff --git a/app/views/boards/show.rhtml b/app/views/boards/show.rhtml index 011a25e06..7f1600af0 100644 --- a/app/views/boards/show.rhtml +++ b/app/views/boards/show.rhtml @@ -59,4 +59,12 @@ <p class="nodata"><%= l(:label_no_data) %></p> <% end %> +<% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<% end %> + <% html_title h(@board.name) %> + +<% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> +<% end %> |