diff --git a/app/views/issue_statuses/index.html.erb b/app/views/issue_statuses/index.html.erb index f5e6538c2..b4802c241 100644 --- a/app/views/issue_statuses/index.html.erb +++ b/app/views/issue_statuses/index.html.erb @@ -13,6 +13,7 @@ <% end %> <%=l(:field_is_closed)%> + <% for status in @issue_statuses %> @@ -22,6 +23,13 @@ <%= status.default_done_ratio %> <% end %> <%= checked_image status.is_closed? %> + + <% unless WorkflowTransition.where('old_status_id = ? OR new_status_id = ?', status.id, status.id).exists? %> + + <%= l(:text_status_no_workflow) %> (<%= link_to l(:button_edit), workflows_edit_path(:used_statuses_only => 0) %>) + + <% end %> + <%= reorder_handle(status) %> <%= delete_link issue_status_path(status) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 994ab5315..43d3524ee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1131,6 +1131,7 @@ en: text_length_between: "Length between %{min} and %{max} characters." text_tracker_no_workflow: No workflow defined for this tracker text_role_no_workflow: No workflow defined for this role + text_status_no_workflow: No tracker uses this status in the workflows text_unallowed_characters: Unallowed characters text_comma_separated: Multiple values allowed (comma separated). text_line_separated: Multiple values allowed (one line for each value). diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb index d36dd4559..1825960a0 100644 --- a/test/functional/issue_statuses_controller_test.rb +++ b/test/functional/issue_statuses_controller_test.rb @@ -43,6 +43,21 @@ class IssueStatusesControllerTest < Redmine::ControllerTest assert_response 406 end + def test_index_should_show_warning_when_no_workflow_is_defined + status = IssueStatus.new :name => "No workflow" + status.save! + + get :index + assert_response :success + assert_select 'table.issue_statuses tbody' do + assert_select 'tr:not(:last-of-type) span.icon-warning', :count => 0 + assert_select 'tr:last-of-type' do + assert_select 'td.name', :text => status.name + assert_select 'td:nth-of-type(3) span.icon-warning', :text => /#{I18n.t(:text_status_no_workflow)}/ + end + end + end + def test_new get :new assert_response :success