diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-08-16 16:45:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-08-16 16:45:06 +0000 |
commit | 4cedecad4d336780aae1e073aa41a4a9c2169c8f (patch) | |
tree | 754ed629eae77a0c9fe4ebafb1b3c80b97609a8a /app/controllers/projects_controller.rb | |
parent | 1f991c6a792a76de50d6b373510544e6469751b3 (diff) | |
download | redmine-4cedecad4d336780aae1e073aa41a4a9c2169c8f.tar.gz redmine-4cedecad4d336780aae1e073aa41a4a9c2169c8f.zip |
Added a link to add a new category when creating or editing an issue.
The user is prompted for the category name. The new category is created and the drop-down list updated using an ajax call.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@648 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 582ff3367..920dbd5e4 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -169,8 +169,18 @@ class ProjectsController < ApplicationController def add_issue_category @category = @project.issue_categories.build(params[:category]) if request.post? and @category.save - flash[:notice] = l(:notice_successful_create) - redirect_to :action => 'settings', :tab => 'categories', :id => @project + respond_to do |format| + format.html do + flash[:notice] = l(:notice_successful_create) + redirect_to :action => 'settings', :tab => 'categories', :id => @project + end + format.js do + # IE doesn't support the replace_html rjs method for select box options + render(:update) {|page| page.replace "issue_category_id", + content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]') + } + end + end end end |