summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/activities_helper.rb4
-rw-r--r--app/helpers/issue_relations_helper.rb2
-rw-r--r--app/helpers/repositories_helper.rb2
-rw-r--r--app/helpers/search_helper.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb
index 54e5580a2..526709e4a 100644
--- a/app/helpers/activities_helper.rb
+++ b/app/helpers/activities_helper.rb
@@ -21,9 +21,9 @@ module ActivitiesHelper
def sort_activity_events(events)
events_by_group = events.group_by(&:event_group)
sorted_events = []
- events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each do |event|
+ events.sort_by(&:event_datetime).reverse_each do |event|
if group_events = events_by_group.delete(event.event_group)
- group_events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each_with_index do |e, i|
+ group_events.sort_by(&:event_datetime).reverse.each_with_index do |e, i|
sorted_events << [e, i > 0]
end
end
diff --git a/app/helpers/issue_relations_helper.rb b/app/helpers/issue_relations_helper.rb
index 6208e5600..a1b3b990a 100644
--- a/app/helpers/issue_relations_helper.rb
+++ b/app/helpers/issue_relations_helper.rb
@@ -20,6 +20,6 @@
module IssueRelationsHelper
def collection_for_relation_type_select
values = IssueRelation::TYPES
- values.keys.sort{|x,y| values[x][:order] <=> values[y][:order]}.collect{|k| [l(values[k][:name]), k]}
+ values.keys.sort_by{|k| values[k][:order]}.collect{|k| [l(values[k][:name]), k]}
end
end
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 435041b72..59c97cdc5 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -269,7 +269,7 @@ module RepositoriesHelper
:href => block_given? ? yield(commit.scmid) : commit.scmid
}
end
- heads.sort! { |head1, head2| head1.to_s <=> head2.to_s }
+ heads.sort_by!(&:to_s)
space = nil
heads.each do |head|
if commits_by_scmid.include? head.scmid
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 8788711e7..d7c483048 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -55,7 +55,7 @@ module SearchHelper
def render_results_by_type(results_by_type)
links = []
# Sorts types by results count
- results_by_type.keys.sort {|a, b| results_by_type[b] <=> results_by_type[a]}.each do |t|
+ results_by_type.keys.sort_by {|k| results_by_type[k]}.reverse_each do |t|
c = results_by_type[t]
next if c == 0
text = "#{type_label(t)} (#{c})"