You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
567 B
Ruby
39 lines
567 B
Ruby
class UserDecorator < ApplicationDecorator
|
|
include AvatarHelper
|
|
|
|
def link
|
|
wrap_with_link(username)
|
|
end
|
|
|
|
def img_link
|
|
wrap_with_link(avatar_image_tag)
|
|
end
|
|
|
|
def full_name
|
|
if model.name.present?
|
|
"#{model.name} (#{model.username})"
|
|
else
|
|
model.username
|
|
end
|
|
end
|
|
|
|
def joined_at
|
|
created_at.strftime("%b %-d, %Y")
|
|
end
|
|
|
|
def theme
|
|
model.theme || Theme.default
|
|
end
|
|
|
|
private
|
|
|
|
def wrap_with_link(html)
|
|
if dummy
|
|
html
|
|
else
|
|
h.link_to html, h.profile_path(model), title: username
|
|
end
|
|
end
|
|
|
|
end
|