Patch #31855 » 31855.patch
| app/helpers/workflows_helper.rb | ||
|---|---|---|
|
select_tag("permissions[#{status.id}][#{name}]", options_for_select(options, selected), html_options)
|
||
|
end
|
||
|
def transition_tag(workflows, old_status, new_status, name)
|
||
|
w = workflows.select {|w| w.old_status == old_status && w.new_status == new_status}.size
|
||
|
def transition_tag(transition_count, old_status, new_status, name)
|
||
|
w = transition_count
|
||
|
tag_name = "transitions[#{ old_status.try(:id) || 0 }][#{new_status.id}][#{name}]"
|
||
|
if old_status == new_status
|
||
| app/views/workflows/_form.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<% transition_counts = workflows.each_with_object(Hash.new(0)) {|w,memo| memo[[w.old_status, w.new_status]] += 1} %>
|
||
|
<tbody>
|
||
|
<% for old_status in [nil] + @statuses %>
|
||
|
<% next if old_status.nil? && name != 'always' %>
|
||
| ... | ... | |
|
<% end %>
|
||
|
</td>
|
||
|
<% for new_status in @statuses -%>
|
||
|
<% checked = (old_status == new_status) || workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
|
||
|
<% checked = (old_status == new_status) || (transition_counts[[old_status, new_status]] > 0) %>
|
||
|
<td class="<%= checked ? 'enabled' : '' %>" title="<%= old_status_name %> » <%= new_status.name %>">
|
||
|
<%= transition_tag workflows, old_status, new_status, name %>
|
||
|
<%= transition_tag transition_counts[[old_status, new_status]], old_status, new_status, name %>
|
||
|
</td>
|
||
|
<% end -%>
|
||
|
</tr>
|
||