@@ -33,7 +33,6 class CustomFieldsController < ApplicationController | |||||
33 | case params[:type] |
|
33 | case params[:type] | |
34 | when "IssueCustomField" |
|
34 | when "IssueCustomField" | |
35 | @custom_field = IssueCustomField.new(params[:custom_field]) |
|
35 | @custom_field = IssueCustomField.new(params[:custom_field]) | |
36 | @custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids] |
|
|||
37 | when "UserCustomField" |
|
36 | when "UserCustomField" | |
38 | @custom_field = UserCustomField.new(params[:custom_field]) |
|
37 | @custom_field = UserCustomField.new(params[:custom_field]) | |
39 | when "ProjectCustomField" |
|
38 | when "ProjectCustomField" | |
@@ -54,9 +53,6 class CustomFieldsController < ApplicationController | |||||
54 | def edit |
|
53 | def edit | |
55 | @custom_field = CustomField.find(params[:id]) |
|
54 | @custom_field = CustomField.find(params[:id]) | |
56 | if request.post? and @custom_field.update_attributes(params[:custom_field]) |
|
55 | if request.post? and @custom_field.update_attributes(params[:custom_field]) | |
57 | if @custom_field.is_a? IssueCustomField |
|
|||
58 | @custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : [] |
|
|||
59 | end |
|
|||
60 | flash[:notice] = l(:notice_successful_update) |
|
56 | flash[:notice] = l(:notice_successful_update) | |
61 | redirect_to :action => 'list', :tab => @custom_field.class.name |
|
57 | redirect_to :action => 'list', :tab => @custom_field.class.name | |
62 | end |
|
58 | end |
@@ -67,13 +67,14 function toggle_custom_field_format() { | |||||
67 | </div> |
|
67 | </div> | |
68 |
|
68 | |||
69 | <div class="box"> |
|
69 | <div class="box"> | |
70 |
<% case @custom_field. |
|
70 | <% case @custom_field.class.name | |
71 | when "IssueCustomField" %> |
|
71 | when "IssueCustomField" %> | |
72 |
|
72 | |||
73 | <fieldset><legend><%=l(:label_tracker_plural)%></legend> |
|
73 | <fieldset><legend><%=l(:label_tracker_plural)%></legend> | |
74 | <% for tracker in @trackers %> |
|
74 | <% for tracker in @trackers %> | |
75 | <%= check_box_tag "tracker_ids[]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %> |
|
75 | <%= check_box_tag "custom_field[tracker_ids][]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %> | |
76 | <% end %> |
|
76 | <% end %> | |
|
77 | <%= hidden_field_tag "custom_field[tracker_ids][]", '' %> | |||
77 | </fieldset> |
|
78 | </fieldset> | |
78 | |
|
79 | | |
79 | <p><%= f.check_box :is_required %></p> |
|
80 | <p><%= f.check_box :is_required %></p> |
@@ -34,7 +34,6 class CustomFieldsControllerTest < Test::Unit::TestCase | |||||
34 | def test_post_new_list_custom_field |
|
34 | def test_post_new_list_custom_field | |
35 | assert_difference 'CustomField.count' do |
|
35 | assert_difference 'CustomField.count' do | |
36 | post :new, :type => "IssueCustomField", |
|
36 | post :new, :type => "IssueCustomField", | |
37 | :tracker_ids => ["1"], |
|
|||
38 | :custom_field => {:name => "test_post_new_list", |
|
37 | :custom_field => {:name => "test_post_new_list", | |
39 | :default_value => "", |
|
38 | :default_value => "", | |
40 | :min_length => "0", |
|
39 | :min_length => "0", | |
@@ -45,7 +44,8 class CustomFieldsControllerTest < Test::Unit::TestCase | |||||
45 | :max_length => "0", |
|
44 | :max_length => "0", | |
46 | :is_filter => "0", |
|
45 | :is_filter => "0", | |
47 | :is_required =>"0", |
|
46 | :is_required =>"0", | |
48 |
:field_format => "list" |
|
47 | :field_format => "list", | |
|
48 | :tracker_ids => ["1", ""]} | |||
49 | end |
|
49 | end | |
50 | assert_redirected_to '/custom_fields/list' |
|
50 | assert_redirected_to '/custom_fields/list' | |
51 | field = IssueCustomField.find_by_name('test_post_new_list') |
|
51 | field = IssueCustomField.find_by_name('test_post_new_list') |
General Comments 0
You need to be logged in to leave comments.
Login now