]> source.dussan.org Git - redmine.git/commitdiff
Show warning when no workflow uses the status in the workflows (#30916).
authorGo MAEDA <maeda@farend.jp>
Tue, 26 Feb 2019 08:37:54 +0000 (08:37 +0000)
committerGo MAEDA <maeda@farend.jp>
Tue, 26 Feb 2019 08:37:54 +0000 (08:37 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17903 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/issue_statuses/index.html.erb
config/locales/en.yml
test/functional/issue_statuses_controller_test.rb

index f5e6538c209ac28fec6fd46d57bd5c0b736e1244..b4802c24153d17a149d75e722ae5ea874bcc81dd 100644 (file)
@@ -13,6 +13,7 @@
   <% end %>
   <th><%=l(:field_is_closed)%></th>
   <th></th>
+  <th></th>
   </tr></thead>
   <tbody>
 <% for status in @issue_statuses %>
   <td><%= status.default_done_ratio %></td>
   <% end %>
   <td><%= checked_image status.is_closed? %></td>
+  <td>
+    <% unless WorkflowTransition.where('old_status_id = ? OR new_status_id = ?', status.id, status.id).exists? %>
+      <span class="icon icon-warning">
+        <%= l(:text_status_no_workflow) %> (<%= link_to l(:button_edit), workflows_edit_path(:used_statuses_only => 0) %>)
+      </span>
+    <% end %>
+  </td>
   <td class="buttons">
     <%= reorder_handle(status) %>
     <%= delete_link issue_status_path(status) %>
index 994ab5315cc9f0a3524bc9b69b1e4d6dc7a0a46b..43d3524ee345496c344155e8047e0ece47516125 100644 (file)
@@ -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).
index d36dd4559fab5d310366b281b0e0c87509daba46..1825960a0e334fc41abbb7b6483f5a4560151a02 100644 (file)
@@ -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