@@ -20,16 +20,11 class TrackersController < ApplicationController | |||
|
20 | 20 | |
|
21 | 21 | before_filter :require_admin |
|
22 | 22 | |
|
23 | def index | |
|
24 | list | |
|
25 | render :action => 'list' unless request.xhr? | |
|
26 | end | |
|
23 | verify :method => :post, :only => :destroy, :redirect_to => { :action => :index } | |
|
27 | 24 | |
|
28 | verify :method => :post, :only => :destroy, :redirect_to => { :action => :list } | |
|
29 | ||
|
30 | def list | |
|
25 | def index | |
|
31 | 26 | @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position' |
|
32 |
render :action => " |
|
|
27 | render :action => "index", :layout => false if request.xhr? | |
|
33 | 28 | end |
|
34 | 29 | |
|
35 | 30 | def new |
@@ -40,7 +35,7 class TrackersController < ApplicationController | |||
|
40 | 35 | @tracker.workflows.copy(copy_from) |
|
41 | 36 | end |
|
42 | 37 | flash[:notice] = l(:notice_successful_create) |
|
43 |
redirect_to :action => ' |
|
|
38 | redirect_to :action => 'index' | |
|
44 | 39 | return |
|
45 | 40 | end |
|
46 | 41 | @trackers = Tracker.find :all, :order => 'position' |
@@ -51,7 +46,7 class TrackersController < ApplicationController | |||
|
51 | 46 | @tracker = Tracker.find(params[:id]) |
|
52 | 47 | if request.post? and @tracker.update_attributes(params[:tracker]) |
|
53 | 48 | flash[:notice] = l(:notice_successful_update) |
|
54 |
redirect_to :action => ' |
|
|
49 | redirect_to :action => 'index' | |
|
55 | 50 | return |
|
56 | 51 | end |
|
57 | 52 | @projects = Project.find(:all) |
@@ -64,6 +59,6 class TrackersController < ApplicationController | |||
|
64 | 59 | else |
|
65 | 60 | @tracker.destroy |
|
66 | 61 | end |
|
67 |
redirect_to :action => ' |
|
|
62 | redirect_to :action => 'index' | |
|
68 | 63 | end |
|
69 | 64 | end |
|
1 | NO CONTENT: file renamed from app/views/trackers/list.rhtml to app/views/trackers/index.html.erb |
@@ -35,7 +35,7 class TrackersControllerTest < ActionController::TestCase | |||
|
35 | 35 | def test_index |
|
36 | 36 | get :index |
|
37 | 37 | assert_response :success |
|
38 |
assert_template ' |
|
|
38 | assert_template 'index' | |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | def test_get_new |
@@ -46,7 +46,7 class TrackersControllerTest < ActionController::TestCase | |||
|
46 | 46 | |
|
47 | 47 | def test_post_new |
|
48 | 48 | post :new, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] } |
|
49 |
assert_redirected_to |
|
|
49 | assert_redirected_to :action => 'index' | |
|
50 | 50 | tracker = Tracker.find_by_name('New tracker') |
|
51 | 51 | assert_equal [1], tracker.project_ids.sort |
|
52 | 52 | assert_equal [1, 6], tracker.custom_field_ids |
@@ -55,7 +55,7 class TrackersControllerTest < ActionController::TestCase | |||
|
55 | 55 | |
|
56 | 56 | def test_post_new_with_workflow_copy |
|
57 | 57 | post :new, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1 |
|
58 |
assert_redirected_to |
|
|
58 | assert_redirected_to :action => 'index' | |
|
59 | 59 | tracker = Tracker.find_by_name('New tracker') |
|
60 | 60 | assert_equal 0, tracker.projects.count |
|
61 | 61 | assert_equal Tracker.find(1).workflows.count, tracker.workflows.count |
@@ -84,14 +84,14 class TrackersControllerTest < ActionController::TestCase | |||
|
84 | 84 | def test_post_edit |
|
85 | 85 | post :edit, :id => 1, :tracker => { :name => 'Renamed', |
|
86 | 86 | :project_ids => ['1', '2', ''] } |
|
87 |
assert_redirected_to |
|
|
87 | assert_redirected_to :action => 'index' | |
|
88 | 88 | assert_equal [1, 2], Tracker.find(1).project_ids.sort |
|
89 | 89 | end |
|
90 | 90 | |
|
91 | 91 | def test_post_edit_without_projects |
|
92 | 92 | post :edit, :id => 1, :tracker => { :name => 'Renamed', |
|
93 | 93 | :project_ids => [''] } |
|
94 |
assert_redirected_to |
|
|
94 | assert_redirected_to :action => 'index' | |
|
95 | 95 | assert Tracker.find(1).project_ids.empty? |
|
96 | 96 | end |
|
97 | 97 | |
@@ -106,7 +106,7 class TrackersControllerTest < ActionController::TestCase | |||
|
106 | 106 | assert_difference 'Tracker.count', -1 do |
|
107 | 107 | post :destroy, :id => tracker.id |
|
108 | 108 | end |
|
109 |
assert_redirected_to |
|
|
109 | assert_redirected_to :action => 'index' | |
|
110 | 110 | assert_nil flash[:error] |
|
111 | 111 | end |
|
112 | 112 | |
@@ -114,7 +114,7 class TrackersControllerTest < ActionController::TestCase | |||
|
114 | 114 | assert_no_difference 'Tracker.count' do |
|
115 | 115 | post :destroy, :id => 1 |
|
116 | 116 | end |
|
117 |
assert_redirected_to |
|
|
117 | assert_redirected_to :action => 'index' | |
|
118 | 118 | assert_not_nil flash[:error] |
|
119 | 119 | end |
|
120 | 120 | end |
General Comments 0
You need to be logged in to leave comments.
Login now