diff options
author | Go MAEDA <maeda@farend.jp> | 2019-08-17 02:23:51 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-08-17 02:23:51 +0000 |
commit | 78d3d6c223709b1fe370a40d13f747fef865857b (patch) | |
tree | 5ced78f57044fe4ca7d0caa24ad337c090b3d7ab /app/views/workflows/_form.html.erb | |
parent | 6a871fdcfcda72387f59f91c0fc546da90d16c75 (diff) | |
download | redmine-78d3d6c223709b1fe370a40d13f747fef865857b.tar.gz redmine-78d3d6c223709b1fe370a40d13f747fef865857b.zip |
Speed up workflow edit page rendering (#31855).
Patch by Felix Schäfer.
git-svn-id: http://svn.redmine.org/redmine/trunk@18373 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/workflows/_form.html.erb')
-rw-r--r-- | app/views/workflows/_form.html.erb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/views/workflows/_form.html.erb b/app/views/workflows/_form.html.erb index 542db4e35..32639753c 100644 --- a/app/views/workflows/_form.html.erb +++ b/app/views/workflows/_form.html.erb @@ -21,6 +21,7 @@ <% 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' %> @@ -38,9 +39,9 @@ <% 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> |