From: Go MAEDA Date: Sun, 25 Mar 2018 09:49:52 +0000 (+0000) Subject: Fix: Sort issue custom fields by position in tracker views (#28393). X-Git-Tag: 4.0.0~367 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c437d8db61d6014116f29e1c3b40e5ef311fcff3;p=redmine.git Fix: Sort issue custom fields by position in tracker views (#28393). Patch by Gregor Schmidt. git-svn-id: http://svn.redmine.org/redmine/trunk@17237 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index b0e6979c9..caf6b1165 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -106,6 +106,6 @@ class TrackersController < ApplicationController return end @trackers = Tracker.sorted.to_a - @custom_fields = IssueCustomField.all.sort + @custom_fields = IssueCustomField.sorted end end diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb index 7b5b7ea61..3d71d7694 100644 --- a/app/views/trackers/_form.html.erb +++ b/app/views/trackers/_form.html.erb @@ -21,10 +21,11 @@

<%= hidden_field_tag 'tracker[core_fields][]', '' %> -<% if IssueCustomField.all.any? %> +<% @issue_custom_fields = IssueCustomField.sorted %> +<% if @issue_custom_fields.present? %>

- <% IssueCustomField.all.each do |field| %> + <% @issue_custom_fields.each do |field| %>