]> source.dussan.org Git - redmine.git/commitdiff
Removes RJS from IssuesController.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 19 Jul 2012 17:54:26 +0000 (17:54 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 19 Jul 2012 17:54:26 +0000 (17:54 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10050 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
app/views/issues/_update_form.js.erb [new file with mode: 0644]
test/functional/issues_controller_test.rb

index 246140f45c75469bd34fb5271b9b9e7daac3afce..e7fdb688604b45291bc68bf3939591b5a43e701a 100644 (file)
@@ -127,13 +127,7 @@ class IssuesController < ApplicationController
   def new
     respond_to do |format|
       format.html { render :action => 'new', :layout => !request.xhr? }
-      format.js {
-        render(:update) { |page|
-          page.replace_html 'all_attributes', :partial => 'form'
-          m = User.current.allowed_to?(:log_time, @issue.project) ? 'show' : 'hide'
-          page << "if ($('log_time')) {Element.#{m}('log_time');}"
-        }
-      }
+      format.js { render :partial => 'update_form' }
     end
   end
 
diff --git a/app/views/issues/_update_form.js.erb b/app/views/issues/_update_form.js.erb
new file mode 100644 (file)
index 0000000..89429fc
--- /dev/null
@@ -0,0 +1,9 @@
+Element.update('all_attributes', '<%= escape_javascript(render :partial => 'form') %>');
+
+if ($('log_time')) {
+  <% if User.current.allowed_to?(:log_time, @issue.project) %>
+    Element.show('log_time');
+  <% else %>
+    Element.hide('log_time');
+  <% end %>
+}
index 99a63bb07cb7384e3540939af16f5027556f1d12..b7ab6d0febb0ac638073f66dee5aca4012f1d575 100644 (file)
@@ -1525,7 +1525,9 @@ class IssuesControllerTest < ActionController::TestCase
                                 :description => 'This is the description',
                                 :priority_id => 5}
     assert_response :success
+    assert_template 'update_form'
     assert_template 'form'
+    assert_equal 'text/javascript', response.content_type
 
     issue = assigns(:issue)
     assert_kind_of Issue, issue
@@ -2400,6 +2402,8 @@ class IssuesControllerTest < ActionController::TestCase
                                         :description => 'This is the description',
                                         :priority_id => 5}
     assert_response :success
+    assert_equal 'text/javascript', response.content_type
+    assert_template 'update_form'
     assert_template 'form'
 
     issue = assigns(:issue)