Project

General

Profile

Feature #30916 » no-workflow-warning-for-statuses-v3.patch

Go MAEDA, 2019-02-25 13:01

View differences:

app/views/issue_statuses/index.html.erb
13 13
  <% end %>
14 14
  <th><%=l(:field_is_closed)%></th>
15 15
  <th></th>
16
  <th></th>
16 17
  </tr></thead>
17 18
  <tbody>
18 19
<% for status in @issue_statuses %>
......
22 23
  <td><%= status.default_done_ratio %></td>
23 24
  <% end %>
24 25
  <td><%= checked_image status.is_closed? %></td>
26
  <td>
27
    <% unless WorkflowTransition.where('old_status_id = ? OR new_status_id = ?', status.id, status.id).exists? %>
28
      <span class="icon icon-warning">
29
        <%= l(:text_status_no_workflow) %> (<%= link_to l(:button_edit), workflows_edit_path(:used_statuses_only => 0) %>)
30
      </span>
31
    <% end %>
32
  </td>
25 33
  <td class="buttons">
26 34
    <%= reorder_handle(status) %>
27 35
    <%= delete_link issue_status_path(status) %>
config/locales/en.yml
1131 1131
  text_length_between: "Length between %{min} and %{max} characters."
1132 1132
  text_tracker_no_workflow: No workflow defined for this tracker
1133 1133
  text_role_no_workflow: No workflow defined for this role
1134
  text_status_no_workflow: No tracker uses this status in the workflows
1134 1135
  text_unallowed_characters: Unallowed characters
1135 1136
  text_comma_separated: Multiple values allowed (comma separated).
1136 1137
  text_line_separated: Multiple values allowed (one line for each value).
test/functional/issue_statuses_controller_test.rb
43 43
    assert_response 406
44 44
  end
45 45

  
46
  def test_index_should_show_warning_when_no_workflow_is_defined
47
    status = IssueStatus.new :name => "No workflow"
48
    status.save!
49

  
50
    get :index
51
    assert_response :success
52
    assert_select 'table.issue_statuses tbody' do
53
      assert_select 'tr:not(:last-of-type) span.icon-warning', :count => 0
54
      assert_select 'tr:last-of-type' do
55
        assert_select 'td.name', :text => status.name
56
        assert_select 'td:nth-of-type(3) span.icon-warning', :text => /#{I18n.t(:text_status_no_workflow)}/
57
      end
58
    end
59
  end
60

  
46 61
  def test_new
47 62
    get :new
48 63
    assert_response :success
(5-5/5)