diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6d9928cb..250225787 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -133,43 +133,21 @@ module ApplicationHelper match = el.match(sa_user) user = User.find_by_id(match[2].base62_decode) team ||= current_team - - if user && - team && - UserTeam.user_in_team(user, team).any? - user_t, = user - .user_teams - .where('user_teams.team_id = ?', team) - .first - - user_description = %(
- thumb -
-
- #{user.full_name}
- -
-

#{user.email}

- #{I18n.t('atwho.popover_html', - role: user_t.role.capitalize, - team: user_t.team.name, - time: user_t.created_at.strftime('%B %Y'))} -

) - - raw(image_tag(avatar_path(user, :icon_small), - class: 'atwho-user-img-popover')) + - raw('') + user.full_name + raw('') - end + popover_for_user_name(user, team) end new_text end - # Generate smart annotation link for one user object, without team - def popover_for_user_name(user) + # Generate smart annotation link for one user object + def popover_for_user_name(user, team = nil) + if user && + team && + UserTeam.user_in_team(user, team).any? + user_t, = user + .user_teams + .where('user_teams.team_id = ?', team) + .first + end user_description = %(
thumb @@ -178,7 +156,17 @@ module ApplicationHelper #{user.full_name}
-

#{user.email}

) +

#{user.email}

) + if team.present? + user_description += %(

+ #{I18n.t('atwho.popover_html', + role: user_t.role.capitalize, + team: user_t.team.name, + time: user_t.created_at.strftime('%B %Y'))} +

) + else + user_description += %(

) + end raw(image_tag(Rails.application.routes.url_helpers .avatar_path(user, :icon_small),