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