##// END OF EJS Templates
Don't add the inclusion error when tracker is not set, the blank error is enough....
Don't add the inclusion error when tracker is not set, the blank error is enough. git-svn-id: http://svn.redmine.org/redmine/trunk@15492 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14955:fb6b565a1ec9
r15110:90d14b71b365
Show More
boards_controller.rb
120 lines | 3.7 KiB | text/x-ruby | RubyLexer
/ app / controllers / boards_controller.rb
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Per project forums added....
r526 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/boards_controller.rb....
r6679 #
Jean-Philippe Lang
Per project forums added....
r526 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/boards_controller.rb....
r6679 #
Jean-Philippe Lang
Per project forums added....
r526 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class BoardsController < ApplicationController
Jean-Philippe Lang
Contextual quick search (#3263)....
r2829 default_search_scope :messages
Jean-Philippe Lang
Controller cleanup....
r7901 before_filter :find_project_by_project_id, :find_board_if_available, :authorize
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 accept_rss_auth :index, :show
Jean-Philippe Lang
Per project forums added....
r526
helper :sort
include SortHelper
Jean-Philippe Lang
Added watchers for message boards (watchers controller modified to support any watchable model)....
r527 helper :watchers
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/boards_controller.rb....
r6679
Jean-Philippe Lang
Per project forums added....
r526 def index
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 @boards = @project.boards.preload(:project, :last_message => :author).to_a
Jean-Philippe Lang
Per project forums added....
r526 # show the board if there is only one
if @boards.size == 1
@board = @boards.first
show
end
end
def show
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 respond_to do |format|
format.html {
sort_init 'updated_on', 'desc'
Toshi MARUYAMA
replace tabs to spaces at app/controllers/boards_controller.rb...
r11193 sort_update 'created_on' => "#{Message.table_name}.created_on",
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 'replies' => "#{Message.table_name}.replies_count",
Jean-Philippe Lang
Fixed that messages are not sorted by last reply (#12243)....
r11194 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/boards_controller.rb....
r6679
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 @topic_count = @board.topics.count
Jean-Philippe Lang
Deprecation warnings (#12774)....
r10909 @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
Jean-Philippe Lang
Replaces find(:first/:all) calls....
r10704 @topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC").
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 joins("LEFT OUTER JOIN #{Message.table_name} last_replies_messages ON last_replies_messages.id = #{Message.table_name}.last_reply_id").
Jean-Philippe Lang
Use #per_page instead of #items_per_page....
r11195 limit(@topic_pages.per_page).
Jean-Philippe Lang
Deprecation warnings (#12774)....
r10909 offset(@topic_pages.offset).
Jean-Philippe Lang
Replaces find(:first/:all) calls....
r10704 order(sort_clause).
Jean-Philippe Lang
Fixed that messages are not sorted by last reply (#12243)....
r11194 preload(:author, {:last_reply => :author}).
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 to_a
Jean-Philippe Lang
Fixed test_show_with_permission_should_display_the_new_message_form broken by r9351....
r9225 @message = Message.new(:board => @board)
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 render :action => 'show', :layout => !request.xhr?
}
format.atom {
Jean-Philippe Lang
Replaces find(:first/:all) calls....
r10704 @messages = @board.messages.
reorder('created_on DESC').
includes(:author, :board).
limit(Setting.feeds_limit.to_i).
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 to_a
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 render_feed(@messages, :title => "#{@project}: #{@board}")
}
end
Jean-Philippe Lang
Per project forums added....
r526 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/boards_controller.rb....
r6679
Jean-Philippe Lang
Per project forums added....
r526 def new
Jean-Philippe Lang
Prevent mass-assignment when adding/updating a forum (#10390)....
r9020 @board = @project.boards.build
@board.safe_attributes = params[:board]
Jean-Philippe Lang
Resourcified boards....
r7900 end
def create
Jean-Philippe Lang
Prevent mass-assignment when adding/updating a forum (#10390)....
r9020 @board = @project.boards.build
@board.safe_attributes = params[:board]
Jean-Philippe Lang
Resourcified boards....
r7900 if @board.save
Jean-Philippe Lang
Per project forums added....
r526 flash[:notice] = l(:notice_successful_create)
Eric Davis
Refactor: Extract method...
r3420 redirect_to_settings_in_projects
Jean-Philippe Lang
Resourcified boards....
r7900 else
render :action => 'new'
Jean-Philippe Lang
Per project forums added....
r526 end
end
def edit
Jean-Philippe Lang
Resourcified boards....
r7900 end
def update
Jean-Philippe Lang
Prevent mass-assignment when adding/updating a forum (#10390)....
r9020 @board.safe_attributes = params[:board]
if @board.save
Jean-Philippe Lang
Forum list can be reordered with drag and drop (#12909)....
r14955 respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to_settings_in_projects
}
format.js { render :nothing => true }
end
Jean-Philippe Lang
Resourcified boards....
r7900 else
Jean-Philippe Lang
Forum list can be reordered with drag and drop (#12909)....
r14955 respond_to do |format|
format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
end
Jean-Philippe Lang
Per project forums added....
r526 end
end
def destroy
@board.destroy
Eric Davis
Refactor: Extract method...
r3420 redirect_to_settings_in_projects
Jean-Philippe Lang
Per project forums added....
r526 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/boards_controller.rb....
r6679
Jean-Philippe Lang
Per project forums added....
r526 private
Eric Davis
Refactor: Extract method...
r3420 def redirect_to_settings_in_projects
Jean-Philippe Lang
Use named routes in controllers....
r10752 redirect_to settings_project_path(@project, :tab => 'boards')
Eric Davis
Refactor: Extract method...
r3420 end
Eric Davis
Refactor: Split method...
r3421 def find_board_if_available
Jean-Philippe Lang
Per project forums added....
r526 @board = @project.boards.find(params[:id]) if params[:id]
rescue ActiveRecord::RecordNotFound
render_404
end
end