@@ -197,17 +197,26 class ProjectsController < ApplicationController | |||||
197 | # Add a new issue category to @project |
|
197 | # Add a new issue category to @project | |
198 | def add_issue_category |
|
198 | def add_issue_category | |
199 | @category = @project.issue_categories.build(params[:category]) |
|
199 | @category = @project.issue_categories.build(params[:category]) | |
200 |
if request.post? |
|
200 | if request.post? | |
201 | respond_to do |format| |
|
201 | if @category.save | |
202 | format.html do |
|
202 | respond_to do |format| | |
203 | flash[:notice] = l(:notice_successful_create) |
|
203 | format.html do | |
204 | redirect_to :action => 'settings', :tab => 'categories', :id => @project |
|
204 | flash[:notice] = l(:notice_successful_create) | |
|
205 | redirect_to :action => 'settings', :tab => 'categories', :id => @project | |||
|
206 | end | |||
|
207 | format.js do | |||
|
208 | # IE doesn't support the replace_html rjs method for select box options | |||
|
209 | render(:update) {|page| page.replace "issue_category_id", | |||
|
210 | 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]') | |||
|
211 | } | |||
|
212 | end | |||
205 | end |
|
213 | end | |
206 | format.js do |
|
214 | else | |
207 | # IE doesn't support the replace_html rjs method for select box options |
|
215 | respond_to do |format| | |
208 | render(:update) {|page| page.replace "issue_category_id", |
|
216 | format.html | |
209 | 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]') |
|
217 | format.js do | |
210 | } |
|
218 | render(:update) {|page| page.alert(@category.errors.full_messages.join('\n')) } | |
|
219 | end | |||
211 | end |
|
220 | end | |
212 | end |
|
221 | end | |
213 | end |
|
222 | end |
General Comments 0
You need to be logged in to leave comments.
Login now