before_filter :require_admin
verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ],
- :redirect_to => { :action => :list }
+ :redirect_to => { :action => :index }
def index
- list
- render :action => 'list' unless request.xhr?
- end
-
- def list
@issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position"
- render :action => "list", :layout => false if request.xhr?
+ render :action => "index", :layout => false if request.xhr?
end
def new
@issue_status = IssueStatus.new(params[:issue_status])
if @issue_status.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
else
render :action => 'new'
end
@issue_status = IssueStatus.find(params[:id])
if @issue_status.update_attributes(params[:issue_status])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
else
render :action => 'edit'
end
def destroy
IssueStatus.find(params[:id]).destroy
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
rescue
flash[:error] = "Unable to delete issue status"
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
end
def update_issue_done_ratio
else
flash[:error] = l(:error_issue_done_ratios_not_updated)
end
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
end
end
--- /dev/null
+<div class="contextual">
+<%= link_to l(:label_issue_status_new), {:action => 'new'}, :class => 'icon icon-add' %>
+<%= link_to(l(:label_update_issue_done_ratios), {:action => 'update_issue_done_ratio'}, :class => 'icon icon-multiple', :method => 'post', :confirm => l(:text_are_you_sure)) if Issue.use_status_for_done_ratio? %>
+</div>
+
+<h2><%=l(:label_issue_status_plural)%></h2>
+
+<table class="list">
+ <thead><tr>
+ <th><%=l(:field_status)%></th>
+ <% if Issue.use_status_for_done_ratio? %>
+ <th><%=l(:field_done_ratio)%></th>
+ <% end %>
+ <th><%=l(:field_is_default)%></th>
+ <th><%=l(:field_is_closed)%></th>
+ <th><%=l(:button_sort)%></th>
+ <th></th>
+ </tr></thead>
+ <tbody>
+<% for status in @issue_statuses %>
+ <tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to status.name, :action => 'edit', :id => status %></td>
+ <% if Issue.use_status_for_done_ratio? %>
+ <td align="center"><%= h status.default_done_ratio %></td>
+ <% end %>
+ <td align="center"><%= image_tag 'true.png' if status.is_default? %></td>
+ <td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>
+ <td align="center" style="width:15%;"><%= reorder_links('issue_status', {:action => 'update', :id => status}) %></td>
+ <td class="buttons">
+ <%= link_to(l(:button_delete), { :action => 'destroy', :id => status },
+ :method => :post,
+ :confirm => l(:text_are_you_sure),
+ :class => 'icon icon-del') %>
+ </td>
+ </tr>
+<% end %>
+ </tbody>
+</table>
+
+<p class="pagination"><%= pagination_links_full @issue_status_pages %></p>
+
+<% html_title(l(:label_issue_status_plural)) -%>
+++ /dev/null
-<div class="contextual">
-<%= link_to l(:label_issue_status_new), {:action => 'new'}, :class => 'icon icon-add' %>
-<%= link_to(l(:label_update_issue_done_ratios), {:action => 'update_issue_done_ratio'}, :class => 'icon icon-multiple', :method => 'post', :confirm => l(:text_are_you_sure)) if Issue.use_status_for_done_ratio? %>
-</div>
-
-<h2><%=l(:label_issue_status_plural)%></h2>
-
-<table class="list">
- <thead><tr>
- <th><%=l(:field_status)%></th>
- <% if Issue.use_status_for_done_ratio? %>
- <th><%=l(:field_done_ratio)%></th>
- <% end %>
- <th><%=l(:field_is_default)%></th>
- <th><%=l(:field_is_closed)%></th>
- <th><%=l(:button_sort)%></th>
- <th></th>
- </tr></thead>
- <tbody>
-<% for status in @issue_statuses %>
- <tr class="<%= cycle("odd", "even") %>">
- <td><%= link_to status.name, :action => 'edit', :id => status %></td>
- <% if Issue.use_status_for_done_ratio? %>
- <td align="center"><%= h status.default_done_ratio %></td>
- <% end %>
- <td align="center"><%= image_tag 'true.png' if status.is_default? %></td>
- <td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>
- <td align="center" style="width:15%;"><%= reorder_links('issue_status', {:action => 'update', :id => status}) %></td>
- <td class="buttons">
- <%= link_to(l(:button_delete), { :action => 'destroy', :id => status },
- :method => :post,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del') %>
- </td>
- </tr>
-<% end %>
- </tbody>
-</table>
-
-<p class="pagination"><%= pagination_links_full @issue_status_pages %></p>
-
-<% html_title(l(:label_issue_status_plural)) -%>
end
def test_index
- # TODO: unify with #list
get :index
assert_response :success
- assert_template 'list'
+ assert_template 'index'
end
def test_new
assert_difference 'IssueStatus.count' do
post :create, :issue_status => {:name => 'New status'}
end
- assert_redirected_to 'issue_statuses/list'
+ assert_redirected_to :action => 'index'
status = IssueStatus.find(:first, :order => 'id DESC')
assert_equal 'New status', status.name
end
def test_update
post :update, :id => '3', :issue_status => {:name => 'Renamed status'}
- assert_redirected_to 'issue_statuses/list'
+ assert_redirected_to :action => 'index'
status = IssueStatus.find(3)
assert_equal 'Renamed status', status.name
end
assert_difference 'IssueStatus.count', -1 do
post :destroy, :id => '1'
end
- assert_redirected_to 'issue_statuses/list'
+ assert_redirected_to :action => 'index'
assert_nil IssueStatus.find_by_id(1)
end
assert_no_difference 'IssueStatus.count' do
post :destroy, :id => '1'
end
- assert_redirected_to 'issue_statuses/list'
+ assert_redirected_to :action => 'index'
assert_not_nil IssueStatus.find_by_id(1)
end
end
should_set_the_flash_to /not updated/
- should_redirect_to('the list') { '/issue_statuses/list' }
+ should_redirect_to('the index') { '/issue_statuses' }
end
context "with Setting.issue_done_ratio using the issue_status" do
end
should_set_the_flash_to /Issue done ratios updated/
- should_redirect_to('the list') { '/issue_statuses/list' }
+ should_redirect_to('the index') { '/issue_statuses' }
end
end