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