Sha256: 38b251ca19edfed2511297d009844e3535d6543d389d53c26f5d77b72b30ae51
Contents?: true
Size: 1 KB
Versions: 76
Compression:
Stored size: 1 KB
Contents
module Pageflow module Admin class EntryUserBadgeList < ViewComponent builder_method :entry_user_badge_list def build(entry) ul class: 'badge_list' do entry.memberships.each do |membership| build_badge(membership) end end end private def build_badge(membership) li do span(user_initials(membership.user), class: 'abbreviation') div class: 'tooltip' do role_string = " (#{I18n.t(membership.role, scope: 'activerecord.values.pageflow/membership.role')})" if authorized?(:read, membership.user) link_to(membership.user.full_name, admin_user_path(membership.user)) + role_string else span class: 'name' do membership.user.full_name + role_string end end end end end def user_initials(user) user.first_name[0] + user.last_name[0] end end end end
Version data entries
76 entries across 76 versions & 1 rubygems