From 34d14be556e38774b399517e48c561f2c8b72776 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 9 Dec 2009 10:58:51 +0000 Subject: [PATCH] Adds custom field selection on tracker form. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3145 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/trackers/_form.rhtml | 14 ++++++++++++++ test/functional/trackers_controller_test.rb | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/views/trackers/_form.rhtml b/app/views/trackers/_form.rhtml index d8d35ba36..a14122c6b 100644 --- a/app/views/trackers/_form.rhtml +++ b/app/views/trackers/_form.rhtml @@ -6,6 +6,20 @@

<%= f.text_field :name, :required => true %>

<%= f.check_box :is_in_chlog %>

<%= f.check_box :is_in_roadmap %>

+ +<% if IssueCustomField.all.any? %> +

+ + <% IssueCustomField.all.each do |field| %> + + <% end %> +

+<%= hidden_field_tag 'tracker[custom_field_ids][]', '' %> +<% end %> + <% if @tracker.new_record? && @trackers.any? %>

<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name)) %>

diff --git a/test/functional/trackers_controller_test.rb b/test/functional/trackers_controller_test.rb index ec412245a..8d5787cda 100644 --- a/test/functional/trackers_controller_test.rb +++ b/test/functional/trackers_controller_test.rb @@ -22,7 +22,7 @@ require 'trackers_controller' class TrackersController; def rescue_action(e) raise e end; end class TrackersControllerTest < ActionController::TestCase - fixtures :trackers, :projects, :projects_trackers, :users, :issues + fixtures :trackers, :projects, :projects_trackers, :users, :issues, :custom_fields def setup @controller = TrackersController.new @@ -45,10 +45,11 @@ class TrackersControllerTest < ActionController::TestCase end def test_post_new - post :new, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''] } + post :new, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] } assert_redirected_to '/trackers/list' tracker = Tracker.find_by_name('New tracker') assert_equal [1], tracker.project_ids.sort + assert_equal [1, 6], tracker.custom_field_ids assert_equal 0, tracker.workflows.count end