@@ -113,7 +113,6 class ProjectsController < ApplicationController | |||||
113 | # Edit @project |
|
113 | # Edit @project | |
114 | def edit |
|
114 | def edit | |
115 | if request.post? |
|
115 | if request.post? | |
116 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
|||
117 | if params[:custom_fields] |
|
116 | if params[:custom_fields] | |
118 | @custom_values = ProjectCustomField.find(:all, :order => "#{CustomField.table_name}.position").collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
117 | @custom_values = ProjectCustomField.find(:all, :order => "#{CustomField.table_name}.position").collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } | |
119 | @project.custom_values = @custom_values |
|
118 | @project.custom_values = @custom_values |
@@ -35,10 +35,11 | |||||
35 | <fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend> |
|
35 | <fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend> | |
36 | <% for custom_field in @custom_fields %> |
|
36 | <% for custom_field in @custom_fields %> | |
37 | <label class="floating"> |
|
37 | <label class="floating"> | |
38 |
<%= check_box_tag |
|
38 | <%= check_box_tag 'project[custom_field_ids][]', custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %> | |
39 | <%= custom_field.name %> |
|
39 | <%= custom_field.name %> | |
40 | </label> |
|
40 | </label> | |
41 | <% end %> |
|
41 | <% end %> | |
|
42 | <%= hidden_field_tag 'project[custom_field_ids][]', '' %> | |||
42 | </fieldset> |
|
43 | </fieldset> | |
43 | <% end %> |
|
44 | <% end %> | |
44 | <!--[eoform:project]--> |
|
45 | <!--[eoform:project]--> |
@@ -71,7 +71,8 class ProjectsControllerTest < Test::Unit::TestCase | |||||
71 |
|
71 | |||
72 | def test_edit |
|
72 | def test_edit | |
73 | @request.session[:user_id] = 2 # manager |
|
73 | @request.session[:user_id] = 2 # manager | |
74 |
post :edit, :id => 1, :project => {:name => 'Test changed name' |
|
74 | post :edit, :id => 1, :project => {:name => 'Test changed name', | |
|
75 | :custom_field_ids => ['']} | |||
75 | assert_redirected_to 'projects/settings/ecookbook' |
|
76 | assert_redirected_to 'projects/settings/ecookbook' | |
76 | project = Project.find(1) |
|
77 | project = Project.find(1) | |
77 | assert_equal 'Test changed name', project.name |
|
78 | assert_equal 'Test changed name', project.name |
General Comments 0
You need to be logged in to leave comments.
Login now