comparison app/controllers/boards_controller.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents 0c939c159af4
children 5f33065ddc4b
comparison
equal deleted inserted replaced
908:c6c2cbd0afee 909:cbb26bc654de
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
8 # 8 #
9 # This program is distributed in the hope that it will be useful, 9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. 12 # GNU General Public License for more details.
13 # 13 #
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 class BoardsController < ApplicationController 18 class BoardsController < ApplicationController
24 include MessagesHelper 24 include MessagesHelper
25 helper :sort 25 helper :sort
26 include SortHelper 26 include SortHelper
27 helper :watchers 27 helper :watchers
28 include WatchersHelper 28 include WatchersHelper
29 29
30 def index 30 def index
31 @boards = @project.boards 31 @boards = @project.boards
32 # show the board if there is only one 32 # show the board if there is only one
33 if @boards.size == 1 33 if @boards.size == 1
34 @board = @boards.first 34 @board = @boards.first
41 format.html { 41 format.html {
42 sort_init 'updated_on', 'desc' 42 sort_init 'updated_on', 'desc'
43 sort_update 'created_on' => "#{Message.table_name}.created_on", 43 sort_update 'created_on' => "#{Message.table_name}.created_on",
44 'replies' => "#{Message.table_name}.replies_count", 44 'replies' => "#{Message.table_name}.replies_count",
45 'updated_on' => "#{Message.table_name}.updated_on" 45 'updated_on' => "#{Message.table_name}.updated_on"
46 46
47 @topic_count = @board.topics.count 47 @topic_count = @board.topics.count
48 @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] 48 @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page']
49 @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '), 49 @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '),
50 :include => [:author, {:last_reply => :author}], 50 :include => [:author, {:last_reply => :author}],
51 :limit => @topic_pages.items_per_page, 51 :limit => @topic_pages.items_per_page,
59 :limit => Setting.feeds_limit.to_i 59 :limit => Setting.feeds_limit.to_i
60 render_feed(@messages, :title => "#{@project}: #{@board}") 60 render_feed(@messages, :title => "#{@project}: #{@board}")
61 } 61 }
62 end 62 end
63 end 63 end
64 64
65 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index } 65 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index }
66 66
67 def new 67 def new
68 @board = Board.new(params[:board]) 68 @board = Board.new(params[:board])
69 @board.project = @project 69 @board.project = @project
81 81
82 def destroy 82 def destroy
83 @board.destroy 83 @board.destroy
84 redirect_to_settings_in_projects 84 redirect_to_settings_in_projects
85 end 85 end
86 86
87 private 87 private
88 def redirect_to_settings_in_projects 88 def redirect_to_settings_in_projects
89 redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' 89 redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
90 end 90 end
91 91