Removes RJS from JournalsController.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10054 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-07-19 19:10:18 +00:00
parent e8469e2c5b
commit 3eaa998c28
7 changed files with 43 additions and 39 deletions
+2 -10
View File
@@ -67,16 +67,8 @@ class JournalsController < ApplicationController
end
# Replaces pre blocks with [...]
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
render(:update) { |page|
page.<< "$('notes').value = \"#{escape_javascript content}\";"
page.show 'update'
page << "Form.Element.focus('notes');"
page << "Element.scrollTo('update');"
page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
}
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
end
def edit
+2
View File
@@ -0,0 +1,2 @@
Element.hide("journal-<%= @journal.id %>-notes");
Element.insert("journal-<%= @journal.id %>-notes", {'after': '<%= escape_javascript(render :partial => 'notes_form') %>'});
-3
View File
@@ -1,3 +0,0 @@
page.hide "journal-#{@journal.id}-notes"
page.insert_html :after, "journal-#{@journal.id}-notes",
:partial => 'notes_form'
+5
View File
@@ -0,0 +1,5 @@
$('notes').value = "<%= raw escape_javascript(@content) %>";
Element.show('update');
Form.Element.focus('notes');
Element.scrollTo('update');
$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;
+9
View File
@@ -0,0 +1,9 @@
<% if @journal.frozen? %>
Element.remove("change-<%= @journal.id %>");
<% else %>
Element.replace("journal-<%= @journal.id %>-notes", '<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');
Element.show("journal-<%= @journal.id %>-notes");
Element.remove("journal-<%= @journal.id %>-form");
<% end %>
<%= call_hook(:view_journals_update_js_bottom, { :journal => @journal }) %>
-10
View File
@@ -1,10 +0,0 @@
if @journal.frozen?
# journal was destroyed
page.remove "change-#{@journal.id}"
else
page.replace "journal-#{@journal.id}-notes", render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))
page.show "journal-#{@journal.id}-notes"
page.remove "journal-#{@journal.id}-form"
end
call_hook(:view_journals_update_rjs_bottom, { :page => page, :journal => @journal })