Class: Decidim::UserPresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Decidim::UserPresenter
- Includes:
- ActionView::Helpers::UrlHelper, TranslatableAttributes
- Defined in:
- app/presenters/decidim/user_presenter.rb
Overview
Decorator for users
Direct Known Subclasses
Instance Method Summary collapse
- #badge ⇒ Object
- #can_be_contacted? ⇒ Boolean
- #can_follow? ⇒ Boolean
- #direct_messages_enabled?(context) ⇒ Boolean
- #display_mention ⇒ Object
- #has_tooltip? ⇒ Boolean
-
#nickname ⇒ Object
nickname presented in a twitter-like style.
- #officialization_text ⇒ Object
- #profile_path ⇒ Object
- #profile_url ⇒ Object
Methods included from TranslatableAttributes
Instance Method Details
#badge ⇒ Object
19 20 21 22 23 |
# File 'app/presenters/decidim/user_presenter.rb', line 19 def badge return "" unless officialized? "verified-badge" end |
#can_be_contacted? ⇒ Boolean
49 50 51 |
# File 'app/presenters/decidim/user_presenter.rb', line 49 def can_be_contacted? true end |
#can_follow? ⇒ Boolean
58 59 60 |
# File 'app/presenters/decidim/user_presenter.rb', line 58 def can_follow? true end |
#direct_messages_enabled?(context) ⇒ Boolean
39 40 41 42 43 |
# File 'app/presenters/decidim/user_presenter.rb', line 39 def (context) return false unless __getobj__.respond_to?(:accepts_conversation?) __getobj__.accepts_conversation?(context[:current_user]) end |
#display_mention ⇒ Object
45 46 47 |
# File 'app/presenters/decidim/user_presenter.rb', line 45 def display_mention link_to nickname, profile_path, class: "user-mention" end |
#has_tooltip? ⇒ Boolean
62 63 64 |
# File 'app/presenters/decidim/user_presenter.rb', line 62 def has_tooltip? true end |
#nickname ⇒ Object
nickname presented in a twitter-like style
15 16 17 |
# File 'app/presenters/decidim/user_presenter.rb', line 15 def nickname "@#{__getobj__.nickname}" end |
#officialization_text ⇒ Object
53 54 55 56 |
# File 'app/presenters/decidim/user_presenter.rb', line 53 def officialization_text translated_attribute(officialized_as).presence || I18n.t("decidim.profiles.default_officialization_text_for_users") end |
#profile_path ⇒ Object
33 34 35 36 37 |
# File 'app/presenters/decidim/user_presenter.rb', line 33 def profile_path return "" if respond_to?(:deleted?) && deleted? decidim.profile_path(__getobj__.nickname) end |
#profile_url ⇒ Object
27 28 29 30 31 |
# File 'app/presenters/decidim/user_presenter.rb', line 27 def profile_url return "" if respond_to?(:deleted?) && deleted? decidim.profile_url(__getobj__.nickname, host: __getobj__.organization.host) end |