##// END OF EJS Templates
Option for long text custom fields to be displayed under the description field (#21705)....
Option for long text custom fields to be displayed under the description field (#21705). Based on patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@16251 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15784:583ee1c8c570
r15869:b40d66f39fa8
Show More
boards_controller.rb
121 lines | 3.5 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
Use .before_action instead of .before_filter....
r15273 before_action :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'
Jean-Philippe Lang
Sort messages by ids to avoid the left join....
r15200 sort_update 'created_on' => "#{Message.table_name}.id",
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 'replies' => "#{Message.table_name}.replies_count",
Jean-Philippe Lang
Sort messages by ids to avoid the left join....
r15200 'updated_on' => "COALESCE(#{Message.table_name}.last_reply_id, #{Message.table_name}.id)"
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.
Jean-Philippe Lang
Sort messages by ids to avoid the left join....
r15200 reorder(:sticky => :desc).
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.
Jean-Philippe Lang
Sort messages by ids to avoid the left join....
r15200 reorder(:id => :desc).
Jean-Philippe Lang
Replaces find(:first/:all) calls....
r10704 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
}
Jean-Philippe Lang
Use head instead of render :nothing => true....
r15305 format.js { head 200 }
Jean-Philippe Lang
Forum list can be reordered with drag and drop (#12909)....
r14955 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' }
Jean-Philippe Lang
Use head instead of render :nothing => true....
r15305 format.js { head 422 }
Jean-Philippe Lang
Forum list can be reordered with drag and drop (#12909)....
r14955 end
Jean-Philippe Lang
Per project forums added....
r526 end
end
def destroy
Jean-Philippe Lang
Adds a flash message when deleting a board (#24535)....
r15784 if @board.destroy
flash[:notice] = l(:notice_successful_delete)
end
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