diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-12-22 14:31:42 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-02 11:44:08 -0600 |
commit | 2eb0beb661cf1a97e3f36ae2785bb1ad44afd5d0 (patch) | |
tree | 4b159cd46f19ff8eabf5ea11b307ae0cf75a8330 | |
parent | 313aa339b9b2cda26c9160f70444f107e2aafef4 (diff) | |
download | gitlab-ce-2eb0beb661cf1a97e3f36ae2785bb1ad44afd5d0.tar.gz |
add natural sorting token for build names
-rw-r--r-- | app/models/commit_status.rb | 6 | ||||
-rw-r--r-- | app/views/projects/stage/_graph.html.haml | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 31cd381dcd2..897e53fc7bd 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -137,4 +137,10 @@ class CommitStatus < ActiveRecord::Base .new(self, current_user) .fabricate! end + + def natsort_name + name.split(/(\d+)/).map do |v| + v =~ /\d+/ ? v.to_i : v + end + end end diff --git a/app/views/projects/stage/_graph.html.haml b/app/views/projects/stage/_graph.html.haml index d9d392fa02f..faadcfee30c 100644 --- a/app/views/projects/stage/_graph.html.haml +++ b/app/views/projects/stage/_graph.html.haml @@ -1,6 +1,6 @@ - stage = local_assigns.fetch(:stage) - statuses = stage.statuses.latest -- status_groups = statuses.sort_by(&:name).group_by(&:group_name) +- status_groups = statuses.sort_by(&:natsort_name).group_by(&:group_name) %li.stage-column .stage-name %a{ name: stage.name } |