2012-07-15 18:12:17 +04:00
|
|
|
<%= render :partial => 'action_menu' %>
|
|
|
|
|
2013-07-28 15:50:18 +04:00
|
|
|
<%= title l(:label_workflow) %>
|
2012-07-15 18:12:17 +04:00
|
|
|
|
|
|
|
<div class="tabs">
|
|
|
|
<ul>
|
2014-02-25 06:54:47 +04:00
|
|
|
<li><%= link_to l(:label_status_transitions), workflows_edit_path(:role_id => @roles, :tracker_id => @trackers) %></li>
|
|
|
|
<li><%= link_to l(:label_fields_permissions), workflows_permissions_path(:role_id => @roles, :tracker_id => @trackers), :class => 'selected' %></li>
|
2012-07-15 18:12:17 +04:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p><%=l(:text_workflow_edit)%>:</p>
|
|
|
|
|
|
|
|
<%= form_tag({}, :method => 'get') do %>
|
|
|
|
<p>
|
|
|
|
<label><%=l(:label_role)%>:
|
2014-02-25 06:54:47 +04:00
|
|
|
<%= options_for_workflow_select 'role_id[]', Role.sorted, @roles, :id => 'role_id', :class => 'expandable' %>
|
|
|
|
</label>
|
|
|
|
<a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a>
|
2012-07-15 18:12:17 +04:00
|
|
|
|
|
|
|
<label><%=l(:label_tracker)%>:
|
2014-02-25 06:54:47 +04:00
|
|
|
<%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
|
|
|
|
</label>
|
|
|
|
<a href="#" data-expands="#tracker_id"><%= image_tag 'bullet_toggle_plus.png' %></a>
|
2012-07-15 18:12:17 +04:00
|
|
|
|
|
|
|
<%= submit_tag l(:button_edit), :name => nil %>
|
2012-07-15 19:46:14 +04:00
|
|
|
|
|
|
|
<%= hidden_field_tag 'used_statuses_only', '0' %>
|
|
|
|
<label><%= check_box_tag 'used_statuses_only', '1', @used_statuses_only %> <%= l(:label_display_used_statuses_only) %></label>
|
2012-07-15 18:12:17 +04:00
|
|
|
</p>
|
|
|
|
<% end %>
|
|
|
|
|
2014-02-25 06:54:47 +04:00
|
|
|
<% if @trackers && @roles && @statuses.any? %>
|
2012-07-15 18:12:17 +04:00
|
|
|
<%= form_tag({}, :id => 'workflow_form' ) do %>
|
2014-02-25 06:54:47 +04:00
|
|
|
<%= @trackers.map {|tracker| hidden_field_tag 'tracker_id[]', tracker.id}.join.html_safe %>
|
|
|
|
<%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id}.join.html_safe %>
|
2012-07-15 19:50:57 +04:00
|
|
|
<%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only] %>
|
2012-07-15 18:12:17 +04:00
|
|
|
<div class="autoscroll">
|
2014-02-25 06:54:47 +04:00
|
|
|
<table class="list workflows fields_permissions">
|
2012-07-15 18:12:17 +04:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2013-11-12 01:01:21 +04:00
|
|
|
<th>
|
2012-07-15 18:12:17 +04:00
|
|
|
</th>
|
2013-11-12 01:01:21 +04:00
|
|
|
<th colspan="<%= @statuses.length %>"><%=l(:label_issue_status)%></th>
|
2012-07-15 18:12:17 +04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<% for status in @statuses %>
|
2013-11-12 01:01:21 +04:00
|
|
|
<td style="width:<%= 75 / @statuses.size %>%;">
|
2012-07-15 18:12:17 +04:00
|
|
|
<%=h status.name %>
|
|
|
|
</td>
|
|
|
|
<% end %>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr class="group open">
|
|
|
|
<td colspan="<%= @statuses.size + 1 %>">
|
|
|
|
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
|
|
|
<%= l(:field_core_fields) %>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<% @fields.each do |field, name| %>
|
|
|
|
<tr class="<%= cycle("odd", "even") %>">
|
2013-11-12 01:01:21 +04:00
|
|
|
<td class="name">
|
2012-07-16 20:33:27 +04:00
|
|
|
<%=h name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
|
2012-07-15 18:12:17 +04:00
|
|
|
</td>
|
|
|
|
<% for status in @statuses -%>
|
2013-11-12 01:01:21 +04:00
|
|
|
<td class="<%= @permissions[status.id][field] %>">
|
2014-02-25 06:54:47 +04:00
|
|
|
<%= field_permission_tag(@permissions, status, field, @roles) %>
|
2013-05-28 14:59:04 +04:00
|
|
|
<% unless status == @statuses.last %><a href="#" class="repeat-value">»</a><% end %>
|
2012-07-15 18:12:17 +04:00
|
|
|
</td>
|
|
|
|
<% end -%>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
<% if @custom_fields.any? %>
|
|
|
|
<tr class="group open">
|
|
|
|
<td colspan="<%= @statuses.size + 1 %>">
|
|
|
|
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
|
|
|
<%= l(:label_custom_field_plural) %>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<% @custom_fields.each do |field| %>
|
|
|
|
<tr class="<%= cycle("odd", "even") %>">
|
2013-11-12 01:01:21 +04:00
|
|
|
<td class="name">
|
2012-07-16 20:33:27 +04:00
|
|
|
<%=h field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
|
2012-07-15 18:12:17 +04:00
|
|
|
</td>
|
|
|
|
<% for status in @statuses -%>
|
2013-11-12 01:01:21 +04:00
|
|
|
<td class="<%= @permissions[status.id][field.id.to_s] %>">
|
2014-02-25 06:54:47 +04:00
|
|
|
<%= field_permission_tag(@permissions, status, field, @roles) %>
|
2013-05-28 14:59:04 +04:00
|
|
|
<% unless status == @statuses.last %><a href="#" class="repeat-value">»</a><% end %>
|
2012-07-15 18:12:17 +04:00
|
|
|
</td>
|
|
|
|
<% end -%>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<%= submit_tag l(:button_save) %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2013-05-28 14:59:04 +04:00
|
|
|
|
|
|
|
<%= javascript_tag do %>
|
|
|
|
$("a.repeat-value").click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
var td = $(this).closest('td');
|
|
|
|
var selected = td.find("select").find(":selected").val();
|
|
|
|
td.nextAll('td').find("select").val(selected);
|
|
|
|
});
|
2014-02-25 06:54:47 +04:00
|
|
|
|
|
|
|
$("a[data-expands]").click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
var target = $($(this).attr("data-expands"));
|
|
|
|
if (target.attr("multiple")) {
|
|
|
|
target.attr("multiple", false);
|
|
|
|
target.find("option[value=all]").show();
|
|
|
|
} else {
|
|
|
|
target.attr("multiple", true);
|
|
|
|
target.find("option[value=all]").attr("selected", false).hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-05-28 14:59:04 +04:00
|
|
|
<% end %>
|