Sha256: b914c925616a1ac4702b3414fe587b9bd9b4d694be7e0f9b546d3afb77af18c3
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
module Pageflow module Admin class UserAccountBadgeList < ViewComponent builder_method :user_account_badge_list def build(user) ul class: 'badge_list' do user.account_memberships.each do |membership| if authorized?(:see_badge_belonging_to, membership.entity) build_badge(membership) end end build_admin_badge if user.admin? end end private def build_badge(membership) li do if authorized?(:read, membership.entity) text_node link_to(membership.entity.name, main_app.admin_account_path(membership.entity), class: 'abbreviation') div class: 'tooltip_bubble' do I18n.t(membership.role, scope: 'activerecord.values.pageflow/membership.role') end else span(membership.entity.name, class: 'abbreviation') end end end def build_admin_badge li do span(I18n.t('pageflow.admin.users.roles.admin'), class: 'abbreviation') end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems