##// END OF EJS Templates
Redirect to custom field after create or update....
Jean-Philippe Lang -
r14364:a3efaceb8fd9
parent child
Show More
@@ -43,7 +43,7 class CustomFieldsController < ApplicationController
43 43 if @custom_field.save
44 44 flash[:notice] = l(:notice_successful_create)
45 45 call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
46 redirect_to custom_fields_path(:tab => @custom_field.class.name)
46 redirect_to edit_custom_field_path(@custom_field)
47 47 else
48 48 render :action => 'new'
49 49 end
@@ -56,7 +56,7 class CustomFieldsController < ApplicationController
56 56 if @custom_field.update_attributes(params[:custom_field])
57 57 flash[:notice] = l(:notice_successful_update)
58 58 call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
59 redirect_to custom_fields_path(:tab => @custom_field.class.name)
59 redirect_to edit_custom_field_path(@custom_field)
60 60 else
61 61 render :action => 'edit'
62 62 end
@@ -139,7 +139,7 class CustomFieldsControllerTest < ActionController::TestCase
139 139 end
140 140
141 141 def test_create_list_custom_field
142 assert_difference 'CustomField.count' do
142 field = new_record(IssueCustomField) do
143 143 post :create, :type => "IssueCustomField",
144 144 :custom_field => {:name => "test_post_new_list",
145 145 :default_value => "",
@@ -154,9 +154,8 class CustomFieldsControllerTest < ActionController::TestCase
154 154 :field_format => "list",
155 155 :tracker_ids => ["1", ""]}
156 156 end
157 assert_redirected_to '/custom_fields?tab=IssueCustomField'
158 field = IssueCustomField.find_by_name('test_post_new_list')
159 assert_not_nil field
157 assert_redirected_to "/custom_fields/#{field.id}/edit"
158 assert_equal "test_post_new_list", field.name
160 159 assert_equal ["0.1", "0.2"], field.possible_values
161 160 assert_equal 1, field.trackers.size
162 161 end
@@ -202,7 +201,7 class CustomFieldsControllerTest < ActionController::TestCase
202 201
203 202 def test_update
204 203 put :update, :id => 1, :custom_field => {:name => 'New name'}
205 assert_redirected_to '/custom_fields?tab=IssueCustomField'
204 assert_redirected_to '/custom_fields/1/edit'
206 205
207 206 field = CustomField.find(1)
208 207 assert_equal 'New name', field.name
General Comments 0
You need to be logged in to leave comments. Login now