Module: UsersHelper
- Defined in:
- app/helpers/users_helper.rb
Instance Method Summary collapse
- #current_user?(user) ⇒ Boolean
- #firstname(user) ⇒ Object
-
#gravatar_for(user, options = { size: 50 }) ⇒ Object
Returns the Gravatar (gravatar.com/) for the given user.
- #task_types_for_current_user ⇒ Object
Instance Method Details
#current_user?(user) ⇒ Boolean
15 16 17 |
# File 'app/helpers/users_helper.rb', line 15 def current_user?(user) current_user!=nil && current_user.email == user.email end |
#firstname(user) ⇒ Object
11 12 13 |
# File 'app/helpers/users_helper.rb', line 11 def firstname(user) user.name.split[0] end |
#gravatar_for(user, options = { size: 50 }) ⇒ Object
Returns the Gravatar (gravatar.com/) for the given user.
4 5 6 7 8 9 |
# File 'app/helpers/users_helper.rb', line 4 def gravatar_for(user, = { size: 50 }) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) size = [:size] gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}" image_tag(gravatar_url, alt: user.name, class: "gravatar") end |
#task_types_for_current_user ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/users_helper.rb', line 19 def task_types_for_current_user business = current_user.primary_company_business return [] if business.nil? and not current_user.admin? if not business.nil? TaskType.for_business(business) else TaskType.send :relation end end |