before_filter :require_admin
- def index
- list
- render :action => 'list' unless request.xhr?
- end
-
- verify :method => :post, :only => :destroy, :redirect_to => { :action => :list }
+ verify :method => :post, :only => :destroy, :redirect_to => { :action => :index }
- def list
+ def index
@tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'
- render :action => "list", :layout => false if request.xhr?
+ render :action => "index", :layout => false if request.xhr?
end
def new
@tracker.workflows.copy(copy_from)
end
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
return
end
@trackers = Tracker.find :all, :order => 'position'
@tracker = Tracker.find(params[:id])
if request.post? and @tracker.update_attributes(params[:tracker])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
return
end
@projects = Project.find(:all)
else
@tracker.destroy
end
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
end
end
--- /dev/null
+<div class="contextual">
+<%= link_to l(:label_tracker_new), {:action => 'new'}, :class => 'icon icon-add' %>
+</div>
+
+<h2><%=l(:label_tracker_plural)%></h2>
+
+<table class="list">
+ <thead><tr>
+ <th><%=l(:label_tracker)%></th>
+ <th></th>
+ <th><%=l(:button_sort)%></th>
+ <th></th>
+ </tr></thead>
+ <tbody>
+<% for tracker in @trackers %>
+ <tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td>
+ <td align="center"><% unless tracker.workflows.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td>
+ <td align="center" style="width:15%;"><%= reorder_links('tracker', {:action => 'edit', :id => tracker}) %></td>
+ <td class="buttons">
+ <%= link_to(l(:button_delete), { :action => 'destroy', :id => tracker },
+ :method => :post,
+ :confirm => l(:text_are_you_sure),
+ :class => 'icon icon-del') %>
+ </td>
+ </tr>
+<% end %>
+ </tbody>
+</table>
+
+<p class="pagination"><%= pagination_links_full @tracker_pages %></p>
+
+<% html_title(l(:label_tracker_plural)) -%>
+++ /dev/null
-<div class="contextual">
-<%= link_to l(:label_tracker_new), {:action => 'new'}, :class => 'icon icon-add' %>
-</div>
-
-<h2><%=l(:label_tracker_plural)%></h2>
-
-<table class="list">
- <thead><tr>
- <th><%=l(:label_tracker)%></th>
- <th></th>
- <th><%=l(:button_sort)%></th>
- <th></th>
- </tr></thead>
- <tbody>
-<% for tracker in @trackers %>
- <tr class="<%= cycle("odd", "even") %>">
- <td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td>
- <td align="center"><% unless tracker.workflows.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td>
- <td align="center" style="width:15%;"><%= reorder_links('tracker', {:action => 'edit', :id => tracker}) %></td>
- <td class="buttons">
- <%= link_to(l(:button_delete), { :action => 'destroy', :id => tracker },
- :method => :post,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del') %>
- </td>
- </tr>
-<% end %>
- </tbody>
-</table>
-
-<p class="pagination"><%= pagination_links_full @tracker_pages %></p>
-
-<% html_title(l(:label_tracker_plural)) -%>
def test_index
get :index
assert_response :success
- assert_template 'list'
+ assert_template 'index'
end
def test_get_new
def test_post_new
post :new, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] }
- assert_redirected_to '/trackers/list'
+ assert_redirected_to :action => 'index'
tracker = Tracker.find_by_name('New tracker')
assert_equal [1], tracker.project_ids.sort
assert_equal [1, 6], tracker.custom_field_ids
def test_post_new_with_workflow_copy
post :new, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1
- assert_redirected_to '/trackers/list'
+ assert_redirected_to :action => 'index'
tracker = Tracker.find_by_name('New tracker')
assert_equal 0, tracker.projects.count
assert_equal Tracker.find(1).workflows.count, tracker.workflows.count
def test_post_edit
post :edit, :id => 1, :tracker => { :name => 'Renamed',
:project_ids => ['1', '2', ''] }
- assert_redirected_to '/trackers/list'
+ assert_redirected_to :action => 'index'
assert_equal [1, 2], Tracker.find(1).project_ids.sort
end
def test_post_edit_without_projects
post :edit, :id => 1, :tracker => { :name => 'Renamed',
:project_ids => [''] }
- assert_redirected_to '/trackers/list'
+ assert_redirected_to :action => 'index'
assert Tracker.find(1).project_ids.empty?
end
assert_difference 'Tracker.count', -1 do
post :destroy, :id => tracker.id
end
- assert_redirected_to '/trackers/list'
+ assert_redirected_to :action => 'index'
assert_nil flash[:error]
end
assert_no_difference 'Tracker.count' do
post :destroy, :id => 1
end
- assert_redirected_to '/trackers/list'
+ assert_redirected_to :action => 'index'
assert_not_nil flash[:error]
end
end