Fixed: custom field selection is not saved when unchecking them all on project settings
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1083 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
889bf388be
commit
d79c20c4f2
|
@ -113,7 +113,6 @@ class ProjectsController < ApplicationController
|
||||||
# Edit @project
|
# Edit @project
|
||||||
def edit
|
def edit
|
||||||
if request.post?
|
if request.post?
|
||||||
@project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
|
|
||||||
if params[:custom_fields]
|
if params[:custom_fields]
|
||||||
@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]) }
|
@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]) }
|
||||||
@project.custom_values = @custom_values
|
@project.custom_values = @custom_values
|
||||||
|
|
|
@ -35,10 +35,11 @@
|
||||||
<fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend>
|
<fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend>
|
||||||
<% for custom_field in @custom_fields %>
|
<% for custom_field in @custom_fields %>
|
||||||
<label class="floating">
|
<label class="floating">
|
||||||
<%= check_box_tag "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"} : {}) %>
|
<%= 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"} : {}) %>
|
||||||
<%= custom_field.name %>
|
<%= custom_field.name %>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= hidden_field_tag 'project[custom_field_ids][]', '' %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--[eoform:project]-->
|
<!--[eoform:project]-->
|
||||||
|
|
|
@ -71,7 +71,8 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_edit
|
def test_edit
|
||||||
@request.session[:user_id] = 2 # manager
|
@request.session[:user_id] = 2 # manager
|
||||||
post :edit, :id => 1, :project => {:name => 'Test changed name'}
|
post :edit, :id => 1, :project => {:name => 'Test changed name',
|
||||||
|
:custom_field_ids => ['']}
|
||||||
assert_redirected_to 'projects/settings/ecookbook'
|
assert_redirected_to 'projects/settings/ecookbook'
|
||||||
project = Project.find(1)
|
project = Project.find(1)
|
||||||
assert_equal 'Test changed name', project.name
|
assert_equal 'Test changed name', project.name
|
||||||
|
|
Loading…
Reference in New Issue