Class: UserDecorator
- Inherits:
-
Draper::Decorator
- Object
- Draper::Decorator
- UserDecorator
- Includes:
- Draper::LazyHelpers
- Defined in:
- app/decorators/user_decorator.rb
Instance Method Summary collapse
- #display_credits ⇒ Object
- #display_image ⇒ Object
- #display_image_html(options = {width: 119, height: 121}) ⇒ Object
- #display_name ⇒ Object
- #display_total_of_backs ⇒ Object
- #medium_name ⇒ Object
- #short_name ⇒ Object
Instance Method Details
#display_credits ⇒ Object
27 28 29 |
# File 'app/decorators/user_decorator.rb', line 27 def display_credits number_to_currency source.credits end |
#display_image ⇒ Object
9 10 11 |
# File 'app/decorators/user_decorator.rb', line 9 def display_image source.uploaded_image.thumb_avatar.url || source.image_url || source.gravatar_url || '/assets/user.png' end |
#display_image_html(options = {width: 119, height: 121}) ⇒ Object
13 14 15 16 17 |
# File 'app/decorators/user_decorator.rb', line 13 def display_image_html ={width: 119, height: 121} (%{<div class="avatar_wrapper" style="width: #{[:width]}px; height: #{[:height]}px">} + h.image_tag(display_image, alt: "User", style: "width: #{[:width]}px; height: auto") + %{</div>}).html_safe end |
#display_name ⇒ Object
5 6 7 |
# File 'app/decorators/user_decorator.rb', line 5 def display_name source.name || source.full_name || I18n.t('user.no_name') end |
#display_total_of_backs ⇒ Object
31 32 33 |
# File 'app/decorators/user_decorator.rb', line 31 def display_total_of_backs number_to_currency source.backs.confirmed.sum(:value) end |
#medium_name ⇒ Object
23 24 25 |
# File 'app/decorators/user_decorator.rb', line 23 def medium_name truncate display_name, length: 42 end |
#short_name ⇒ Object
19 20 21 |
# File 'app/decorators/user_decorator.rb', line 19 def short_name truncate display_name, length: 20 end |