summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-19 16:43:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-19 16:43:33 +0000
commit035805fbd04286bff0965b588b7c7dbef6652c63 (patch)
tree61fcc55e4d595f2d255ca8e71e31d57b4d5b1d9d /app
parent51d5a5202942dbbe8e39c51b9d4d53210da490c1 (diff)
downloadredmine-035805fbd04286bff0965b588b7c7dbef6652c63.tar.gz
redmine-035805fbd04286bff0965b588b7c7dbef6652c63.zip
Start removing the RJS stuff.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10043 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issue_categories_controller.rb24
-rw-r--r--app/controllers/versions_controller.rb24
-rw-r--r--app/views/issue_categories/create.js.erb3
-rw-r--r--app/views/issue_categories/new.js.erb3
-rw-r--r--app/views/versions/create.js.erb3
-rw-r--r--app/views/versions/new.js.erb3
6 files changed, 18 insertions, 42 deletions
diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb
index ecb4bc906..e314856e1 100644
--- a/app/controllers/issue_categories_controller.rb
+++ b/app/controllers/issue_categories_controller.rb
@@ -44,13 +44,7 @@ class IssueCategoriesController < ApplicationController
respond_to do |format|
format.html
- format.js do
- render :update do |page|
- page.replace_html 'ajax-modal', :partial => 'issue_categories/new_modal'
- page << "showModal('ajax-modal', '600px');"
- page << "Form.Element.focus('issue_category_name');"
- end
- end
+ format.js
end
end
@@ -63,25 +57,13 @@ class IssueCategoriesController < ApplicationController
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
end
- format.js do
- render(:update) {|page|
- page << 'hideModal();'
- # IE doesn't support the replace_html rjs method for select box options
- page.replace "issue_category_id",
- content_tag('select', content_tag('option') + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]')
- }
- end
+ format.js
format.api { render :action => 'show', :status => :created, :location => issue_category_path(@category) }
end
else
respond_to do |format|
format.html { render :action => 'new'}
- format.js do
- render :update do |page|
- page.replace_html 'ajax-modal', :partial => 'issue_categories/new_modal'
- page << "Form.Element.focus('version_name');"
- end
- end
+ format.js { render :action => 'new'}
format.api { render_validation_errors(@category) }
end
end
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index dcee97c85..8b9c0acd3 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -78,13 +78,7 @@ class VersionsController < ApplicationController
respond_to do |format|
format.html
- format.js do
- render :update do |page|
- page.replace_html 'ajax-modal', :partial => 'versions/new_modal'
- page << "showModal('ajax-modal', '600px');"
- page << "Form.Element.focus('version_name');"
- end
- end
+ format.js
end
end
@@ -103,14 +97,7 @@ class VersionsController < ApplicationController
flash[:notice] = l(:notice_successful_create)
redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
end
- format.js do
- render(:update) {|page|
- page << 'hideModal();'
- # IE doesn't support the replace_html rjs method for select box options
- page.replace "issue_fixed_version_id",
- content_tag('select', content_tag('option') + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]')
- }
- end
+ format.js
format.api do
render :action => 'show', :status => :created, :location => version_url(@version)
end
@@ -118,12 +105,7 @@ class VersionsController < ApplicationController
else
respond_to do |format|
format.html { render :action => 'new' }
- format.js do
- render :update do |page|
- page.replace_html 'ajax-modal', :partial => 'versions/new_modal'
- page << "Form.Element.focus('version_name');"
- end
- end
+ format.js { render :action => 'new' }
format.api { render_validation_errors(@version) }
end
end
diff --git a/app/views/issue_categories/create.js.erb b/app/views/issue_categories/create.js.erb
new file mode 100644
index 000000000..b9cc577aa
--- /dev/null
+++ b/app/views/issue_categories/create.js.erb
@@ -0,0 +1,3 @@
+hideModal();
+<% select = content_tag('select', content_tag('option') + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]') %>
+Element.replace('issue_category_id', '<%= escape_javascript(select) %>');
diff --git a/app/views/issue_categories/new.js.erb b/app/views/issue_categories/new.js.erb
new file mode 100644
index 000000000..2a28e3863
--- /dev/null
+++ b/app/views/issue_categories/new.js.erb
@@ -0,0 +1,3 @@
+Element.update('ajax-modal', '<%= escape_javascript(render :partial => 'issue_categories/new_modal') %>');
+showModal('ajax-modal', '600px');
+Form.Element.focus('issue_category_name');
diff --git a/app/views/versions/create.js.erb b/app/views/versions/create.js.erb
new file mode 100644
index 000000000..01720bf90
--- /dev/null
+++ b/app/views/versions/create.js.erb
@@ -0,0 +1,3 @@
+hideModal();
+<% select = content_tag('select', content_tag('option') + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]') %>
+Element.replace('issue_fixed_version_id', '<%= escape_javascript(select) %>');
diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb
new file mode 100644
index 000000000..cce80e029
--- /dev/null
+++ b/app/views/versions/new.js.erb
@@ -0,0 +1,3 @@
+Element.update('ajax-modal', '<%= escape_javascript(render :partial => 'versions/new_modal') %>');
+showModal('ajax-modal', '600px');
+Form.Element.focus('version_name');