Sha256: 357a6efa107ec937994ded94213ec031fec1aefa0fa7d4b9678c4a7969654b6e

Contents?: true

Size: 818 Bytes

Versions: 100

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

class Avo::SidebarProfileComponent < ViewComponent::Base
  attr_reader :user

  def initialize(user:)
    @user = user
  end

  def avatar
    if user.respond_to?(:avatar) && user.avatar.present?
      user.avatar
    else
      ""
    end
  end

  def name
    if user.respond_to?(:name) && user.name.present?
      user.name
    elsif user.respond_to?(:email) && user.email.present?
      user.email
    else
      "Avo user"
    end
  end

  def title
    if user.respond_to?(:avo_title) && user.avo_title.present?
      user.avo_title
    else
      ""
    end
  end

  def destroy_user_session_path
    "destroy_#{Avo.configuration.current_user_resource_name}_session_path".to_sym
  end

  def can_destroy_user?
    helpers.main_app.respond_to?(destroy_user_session_path)
  end
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
avo-2.18.1 app/components/avo/sidebar_profile_component.rb
avo-2.18.1.pre.1.eagerloaddirs app/components/avo/sidebar_profile_component.rb
avo-2.18.0 app/components/avo/sidebar_profile_component.rb
avo-2.17.1.pre.5.stackedlayout app/components/avo/sidebar_profile_component.rb
avo-2.17.1.pre.4.issue.1342 app/components/avo/sidebar_profile_component.rb
avo-2.17.1.pre.3 app/components/avo/sidebar_profile_component.rb
avo-2.17.1.pre.2.customauthorizationclients app/components/avo/sidebar_profile_component.rb
avo-2.17.1.pre.1.zeitwerk.eager.load.dir app/components/avo/sidebar_profile_component.rb
avo-2.17.0 app/components/avo/sidebar_profile_component.rb
avo-2.16.1.pre.1.nativefields app/components/avo/sidebar_profile_component.rb
avo-2.16.0 app/components/avo/sidebar_profile_component.rb
avo-2.15.3 app/components/avo/sidebar_profile_component.rb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items app/components/avo/sidebar_profile_component.rb
avo-2.15.2 app/components/avo/sidebar_profile_component.rb
avo-2.15.2.pre.1 app/components/avo/sidebar_profile_component.rb
avo-2.15.1 app/components/avo/sidebar_profile_component.rb
avo-2.15.0 app/components/avo/sidebar_profile_component.rb
avo-2.14.3.pre.7.polytranslations1 app/components/avo/sidebar_profile_component.rb
avo-2.14.3.pre.6.nosprockets app/components/avo/sidebar_profile_component.rb
avo-2.14.3.pre.5.nosprockets app/components/avo/sidebar_profile_component.rb