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

Version Path
pageflow-14.5.2 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.6.1 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.6.0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.5.0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.4.0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.3.0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.2.2 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.2.1 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.2.0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.2 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.1 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.rc0 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.beta6 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.beta5 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.beta4 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.beta3 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.beta2 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.1.0.beta1 app/views/components/pageflow/admin/entry_user_badge_list.rb
pageflow-15.0.2 app/views/components/pageflow/admin/entry_user_badge_list.rb