diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-09-26 15:06:07 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-09-26 16:32:26 -0400 |
commit | aa0c4b77b60acfc85d99e9eacaff25e34b136529 (patch) | |
tree | 231d34ab9cb1ac910147c490ec1edc0a975fec17 /app/helpers/application_helper.rb | |
parent | afc4a75499b6678a643e6b62f703f8e7e1eb0f0a (diff) | |
download | gitlab-ce-aa0c4b77b60acfc85d99e9eacaff25e34b136529.tar.gz |
Add current_action? helper
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f874851aee1..185e7d84149 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,5 @@ require 'digest/md5' + module ApplicationHelper # Check if a particular controller is the current one @@ -15,6 +16,20 @@ module ApplicationHelper args.any? { |v| v.to_s.downcase == controller.controller_name } end + # Check if a partcular action is the current one + # + # args - One or more action names to check + # + # Examples + # + # # On Projects#new + # current_action?(:new) # => true + # current_action?(:create) # => false + # current_action?(:new, :create) # => true + def current_action?(*args) + args.any? { |v| v.to_s.downcase == action_name } + end + def gravatar_icon(user_email = '', size = 40) if Gitlab.config.disable_gravatar? || user_email.blank? 'no_avatar.png' |