remove trailing white-spaces from app/controllers/messages_controller.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6895 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
751c0b0813
commit
1f990cda00
|
@ -1,16 +1,16 @@
|
||||||
# redMine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
@ -27,10 +27,10 @@ class MessagesController < ApplicationController
|
||||||
|
|
||||||
helper :watchers
|
helper :watchers
|
||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
|
|
||||||
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
|
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
|
||||||
|
|
||||||
# Show a topic and its replies
|
# Show a topic and its replies
|
||||||
def show
|
def show
|
||||||
page = params[:page]
|
page = params[:page]
|
||||||
|
@ -39,18 +39,18 @@ class MessagesController < ApplicationController
|
||||||
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
|
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
|
||||||
page = 1 + offset / REPLIES_PER_PAGE
|
page = 1 + offset / REPLIES_PER_PAGE
|
||||||
end
|
end
|
||||||
|
|
||||||
@reply_count = @topic.children.count
|
@reply_count = @topic.children.count
|
||||||
@reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page
|
@reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page
|
||||||
@replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}],
|
@replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}],
|
||||||
:order => "#{Message.table_name}.created_on ASC",
|
:order => "#{Message.table_name}.created_on ASC",
|
||||||
:limit => @reply_pages.items_per_page,
|
:limit => @reply_pages.items_per_page,
|
||||||
:offset => @reply_pages.current.offset)
|
:offset => @reply_pages.current.offset)
|
||||||
|
|
||||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||||
render :action => "show", :layout => false if request.xhr?
|
render :action => "show", :layout => false if request.xhr?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create a new topic
|
# Create a new topic
|
||||||
def new
|
def new
|
||||||
@message = Message.new(params[:message])
|
@message = Message.new(params[:message])
|
||||||
|
@ -97,7 +97,7 @@ class MessagesController < ApplicationController
|
||||||
redirect_to :action => 'show', :board_id => @message.board, :id => @message.root, :r => (@message.parent_id && @message.id)
|
redirect_to :action => 'show', :board_id => @message.board, :id => @message.root, :r => (@message.parent_id && @message.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Delete a messages
|
# Delete a messages
|
||||||
def destroy
|
def destroy
|
||||||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||||
|
@ -106,7 +106,7 @@ class MessagesController < ApplicationController
|
||||||
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
||||||
{ :action => 'show', :id => @message.parent, :r => @message }
|
{ :action => 'show', :id => @message.parent, :r => @message }
|
||||||
end
|
end
|
||||||
|
|
||||||
def quote
|
def quote
|
||||||
user = @message.author
|
user = @message.author
|
||||||
text = @message.content
|
text = @message.content
|
||||||
|
@ -123,14 +123,14 @@ class MessagesController < ApplicationController
|
||||||
page << "$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight;"
|
page << "$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight;"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def preview
|
def preview
|
||||||
message = @board.messages.find_by_id(params[:id])
|
message = @board.messages.find_by_id(params[:id])
|
||||||
@attachements = message.attachments if message
|
@attachements = message.attachments if message
|
||||||
@text = (params[:message] || params[:reply])[:content]
|
@text = (params[:message] || params[:reply])[:content]
|
||||||
render :partial => 'common/preview'
|
render :partial => 'common/preview'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def find_message
|
def find_message
|
||||||
find_board
|
find_board
|
||||||
|
@ -139,7 +139,7 @@ private
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_board
|
def find_board
|
||||||
@board = Board.find(params[:board_id], :include => :project)
|
@board = Board.find(params[:board_id], :include => :project)
|
||||||
@project = @board.project
|
@project = @board.project
|
||||||
|
|
Loading…
Reference in New Issue