Make use of tracker_ids association in issue custom field form.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2272 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d1a1e25bb8
commit
5ed2e78ae2
|
@ -33,7 +33,6 @@ class CustomFieldsController < ApplicationController
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when "IssueCustomField"
|
when "IssueCustomField"
|
||||||
@custom_field = IssueCustomField.new(params[:custom_field])
|
@custom_field = IssueCustomField.new(params[:custom_field])
|
||||||
@custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids]
|
|
||||||
when "UserCustomField"
|
when "UserCustomField"
|
||||||
@custom_field = UserCustomField.new(params[:custom_field])
|
@custom_field = UserCustomField.new(params[:custom_field])
|
||||||
when "ProjectCustomField"
|
when "ProjectCustomField"
|
||||||
|
@ -54,9 +53,6 @@ class CustomFieldsController < ApplicationController
|
||||||
def edit
|
def edit
|
||||||
@custom_field = CustomField.find(params[:id])
|
@custom_field = CustomField.find(params[:id])
|
||||||
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
||||||
if @custom_field.is_a? IssueCustomField
|
|
||||||
@custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : []
|
|
||||||
end
|
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to :action => 'list', :tab => @custom_field.class.name
|
redirect_to :action => 'list', :tab => @custom_field.class.name
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,13 +67,14 @@ function toggle_custom_field_format() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<% case @custom_field.type.to_s
|
<% case @custom_field.class.name
|
||||||
when "IssueCustomField" %>
|
when "IssueCustomField" %>
|
||||||
|
|
||||||
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
||||||
<% for tracker in @trackers %>
|
<% for tracker in @trackers %>
|
||||||
<%= check_box_tag "tracker_ids[]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>
|
<%= check_box_tag "custom_field[tracker_ids][]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= hidden_field_tag "custom_field[tracker_ids][]", '' %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<p><%= f.check_box :is_required %></p>
|
<p><%= f.check_box :is_required %></p>
|
||||||
|
|
|
@ -34,7 +34,6 @@ class CustomFieldsControllerTest < Test::Unit::TestCase
|
||||||
def test_post_new_list_custom_field
|
def test_post_new_list_custom_field
|
||||||
assert_difference 'CustomField.count' do
|
assert_difference 'CustomField.count' do
|
||||||
post :new, :type => "IssueCustomField",
|
post :new, :type => "IssueCustomField",
|
||||||
:tracker_ids => ["1"],
|
|
||||||
:custom_field => {:name => "test_post_new_list",
|
:custom_field => {:name => "test_post_new_list",
|
||||||
:default_value => "",
|
:default_value => "",
|
||||||
:min_length => "0",
|
:min_length => "0",
|
||||||
|
@ -45,7 +44,8 @@ class CustomFieldsControllerTest < Test::Unit::TestCase
|
||||||
:max_length => "0",
|
:max_length => "0",
|
||||||
:is_filter => "0",
|
:is_filter => "0",
|
||||||
:is_required =>"0",
|
:is_required =>"0",
|
||||||
:field_format => "list"}
|
:field_format => "list",
|
||||||
|
:tracker_ids => ["1", ""]}
|
||||||
end
|
end
|
||||||
assert_redirected_to '/custom_fields/list'
|
assert_redirected_to '/custom_fields/list'
|
||||||
field = IssueCustomField.find_by_name('test_post_new_list')
|
field = IssueCustomField.find_by_name('test_post_new_list')
|
||||||
|
|
Loading…
Reference in New Issue