Commit 5be53ab3 authored by maeda's avatar maeda

Show warning when no workflow is defined for the role (#30853).

Patch by Go MAEDA.


git-svn-id: https://svn.redmine.org/redmine/trunk@17899 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e1bf6246
...@@ -9,11 +9,19 @@ ...@@ -9,11 +9,19 @@
<thead><tr> <thead><tr>
<th><%=l(:label_role)%></th> <th><%=l(:label_role)%></th>
<th></th> <th></th>
<th></th>
</tr></thead> </tr></thead>
<tbody> <tbody>
<% for role in @roles %> <% for role in @roles %>
<tr class="<%= role.builtin? ? "builtin" : "givable" %>"> <tr class="<%= role.builtin? ? "builtin" : "givable" %>">
<td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td> <td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td>
<td>
<% unless role.builtin? || role.workflow_rules.exists? %>
<span class="icon icon-warning">
<%= l(:text_role_no_workflow) %> (<%= link_to l(:button_edit), workflows_edit_path(:role_id => role) %>)
</span>
<% end %>
</td>
<td class="buttons"> <td class="buttons">
<%= reorder_handle(role) unless role.builtin? %> <%= reorder_handle(role) unless role.builtin? %>
<%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %> <%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %>
......
...@@ -1130,6 +1130,7 @@ en: ...@@ -1130,6 +1130,7 @@ en:
text_caracters_minimum: "Must be at least %{count} characters long." text_caracters_minimum: "Must be at least %{count} characters long."
text_length_between: "Length between %{min} and %{max} characters." text_length_between: "Length between %{min} and %{max} characters."
text_tracker_no_workflow: No workflow defined for this tracker text_tracker_no_workflow: No workflow defined for this tracker
text_role_no_workflow: No workflow defined for this role
text_unallowed_characters: Unallowed characters text_unallowed_characters: Unallowed characters
text_comma_separated: Multiple values allowed (comma separated). text_comma_separated: Multiple values allowed (comma separated).
text_line_separated: Multiple values allowed (one line for each value). text_line_separated: Multiple values allowed (one line for each value).
......
...@@ -35,6 +35,24 @@ class RolesControllerTest < Redmine::ControllerTest ...@@ -35,6 +35,24 @@ class RolesControllerTest < Redmine::ControllerTest
end end
end end
def test_index_should_show_warning_when_no_workflow_is_defined
Role.find_by_name('Developer').workflow_rules.destroy_all
Role.find_by_name('Anonymous').workflow_rules.destroy_all
get :index
assert_response :success
assert_select 'table.roles' do
# Manager
assert_select 'tr.givable:nth-of-type(1) span.icon-warning', :count => 0
# Developer
assert_select 'tr.givable:nth-of-type(2) span.icon-warning', :text => /#{I18n.t(:text_role_no_workflow)}/
# Reporter
assert_select 'tr.givable:nth-of-type(3) span.icon-warning', :count => 0
# No warnings for built-in roles such as Anonymous and Non-member
assert_select 'tr.builtin span.icon-warning', :count => 0
end
end
def test_new def test_new
get :new get :new
assert_response :success assert_response :success
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment