Class: Tramway::User::UserDecorator
- Inherits:
-
Core::ApplicationDecorator
- Object
- Core::ApplicationDecorator
- Tramway::User::UserDecorator
- Defined in:
- app/decorators/tramway/user/user_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #credential_text ⇒ Object
- #name ⇒ Object (also: #title)
- #show_associations ⇒ Object
Class Method Details
.collections ⇒ Object
5 6 7 |
# File 'app/decorators/tramway/user/user_decorator.rb', line 5 def collections [:all] end |
.list_attributes ⇒ Object
9 10 11 |
# File 'app/decorators/tramway/user/user_decorator.rb', line 9 def list_attributes [:email] end |
.show_attributes ⇒ Object
13 14 15 |
# File 'app/decorators/tramway/user/user_decorator.rb', line 13 def show_attributes i[email first_name last_name phone role created_at updated_at credential_text] end |
Instance Method Details
#credential_text ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/decorators/tramway/user/user_decorator.rb', line 32 def credential_text content_tag(:pre) do id = "credential_text_#{object.id}" concat(content_tag(:span, id: id) do text = "URL: #{ENV['PROJECT_URL']}\n" text += "Email: #{object.email}\n" text += "Password: " end) concat(content_tag(:br)) concat copy_to_clipboard id end end |
#name ⇒ Object Also known as: title
28 29 30 |
# File 'app/decorators/tramway/user/user_decorator.rb', line 28 def name "#{object&.first_name} #{object&.last_name}" end |
#show_associations ⇒ Object
18 19 20 |
# File 'app/decorators/tramway/user/user_decorator.rb', line 18 def show_associations [:social_networks] end |