diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-09-25 21:18:00 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-09-26 16:32:24 -0400 |
commit | 60ac6a28a2f198427c2d1ad68421aee484e14028 (patch) | |
tree | c6554dbfc66eb278c814b14a717ded2f80442724 /app | |
parent | cada511f8b88671bb8a99600ed314c3beb5a36f4 (diff) | |
download | gitlab-ce-60ac6a28a2f198427c2d1ad68421aee484e14028.tar.gz |
Allow current_controller? helper to take an Array of options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 505f6067c59..d916d8874a7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,13 +3,16 @@ module ApplicationHelper # Check if a particular controller is the current one # + # args - One or more controller names to check + # # Examples # # # On TreeController - # current_controller?(:tree) # => true - # current_controller?(:commits) # => false - def current_controller?(name) - controller.controller_name == name.to_s.downcase + # current_controller?(:tree) # => true + # current_controller?(:commits) # => false + # current_controller?(:commits, :tree) # => true + def current_controller?(*args) + args.any? { |v| v.to_s.downcase == controller.controller_name } end def gravatar_icon(user_email = '', size = 40) |