Removes RJS from MessagesController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10053 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3386008491
commit
e8469e2c5b
|
@ -105,20 +105,11 @@ class MessagesController < ApplicationController
|
|||
end
|
||||
|
||||
def quote
|
||||
user = @message.author
|
||||
text = @message.content
|
||||
subject = @message.subject.gsub('"', '\"')
|
||||
subject = "RE: #{subject}" unless subject.starts_with?('RE:')
|
||||
content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
|
||||
content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
|
||||
render(:update) { |page|
|
||||
page << "$('message_subject').value = \"#{subject}\";"
|
||||
page.<< "$('message_content').value = \"#{content}\";"
|
||||
page.show 'reply'
|
||||
page << "Form.Element.focus('message_content');"
|
||||
page << "Element.scrollTo('reply');"
|
||||
page << "$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight;"
|
||||
}
|
||||
@subject = @message.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
end
|
||||
|
||||
def preview
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
$('message_subject').value = "<%= raw escape_javascript(@subject) %>";
|
||||
$('message_content').value = "<%= raw escape_javascript(@content) %>";
|
||||
Element.show('reply');
|
||||
Form.Element.focus('message_content');
|
||||
Element.scrollTo('reply');
|
||||
$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight;
|
|
@ -186,7 +186,10 @@ class MessagesControllerTest < ActionController::TestCase
|
|||
@request.session[:user_id] = 2
|
||||
xhr :get, :quote, :board_id => 1, :id => 3
|
||||
assert_response :success
|
||||
assert_select_rjs :show, 'reply'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_template 'quote'
|
||||
assert_include 'RE: First post', response.body
|
||||
assert_include '> An other reply', response.body
|
||||
end
|
||||
|
||||
def test_preview_new
|
||||
|
|
Loading…
Reference in New Issue