@@ -113,7 +113,6 class ProjectsController < ApplicationController | |||
|
113 | 113 | # Edit @project |
|
114 | 114 | def edit |
|
115 | 115 | if request.post? |
|
116 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] | |
|
117 | 116 | if params[:custom_fields] |
|
118 | 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 | 118 | @project.custom_values = @custom_values |
@@ -35,10 +35,11 | |||
|
35 | 35 | <fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend> |
|
36 | 36 | <% for custom_field in @custom_fields %> |
|
37 | 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 | 39 | <%= custom_field.name %> |
|
40 | 40 | </label> |
|
41 | 41 | <% end %> |
|
42 | <%= hidden_field_tag 'project[custom_field_ids][]', '' %> | |
|
42 | 43 | </fieldset> |
|
43 | 44 | <% end %> |
|
44 | 45 | <!--[eoform:project]--> |
@@ -71,7 +71,8 class ProjectsControllerTest < Test::Unit::TestCase | |||
|
71 | 71 | |
|
72 | 72 | def test_edit |
|
73 | 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 | 76 | assert_redirected_to 'projects/settings/ecookbook' |
|
76 | 77 | project = Project.find(1) |
|
77 | 78 | assert_equal 'Test changed name', project.name |
General Comments 0
You need to be logged in to leave comments.
Login now