Class: Avo::SidebarProfileComponent
Constant Summary
Concerns::FindAssociationField::ASSOCIATIONS
Instance Method Summary
collapse
#component_name
#a_button, #a_link, #body_classes, #button_classes, #chart_color, #container_classes, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_license_warning, #root_path_without_url, #rtl?, #text_direction, #ui, #wrap_in_modal
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table
#find_association_field
Instance Method Details
#avatar ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/components/avo/sidebar_profile_component.rb', line 8
def avatar
if @user.respond_to?(:avatar) && @user.avatar.present?
@user.avatar
else
""
end
end
|
#can_sign_out_user? ⇒ Boolean
57
58
59
|
# File 'app/components/avo/sidebar_profile_component.rb', line 57
def can_sign_out_user?
sign_out_path.present? && main_app.respond_to?(sign_out_path&.to_sym)
end
|
#custom_profile_component ⇒ Object
61
62
63
|
# File 'app/components/avo/sidebar_profile_component.rb', line 61
def custom_profile_component
Avo::Sidebar::CustomProfileComponent.new
end
|
#default_sign_out_path ⇒ Object
51
52
53
54
55
|
# File 'app/components/avo/sidebar_profile_component.rb', line 51
def default_sign_out_path
default_path = :"destroy_#{Avo.configuration.current_user_resource_name}_session_path"
default_path if main_app.respond_to?(default_path)
end
|
#initials ⇒ Object
36
37
38
|
# File 'app/components/avo/sidebar_profile_component.rb', line 36
def initials
name.split(" ").map(&:first).join("").first(2).upcase
end
|
#name ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/components/avo/sidebar_profile_component.rb', line 16
def name
if @user.respond_to?(:name) && @user.name.present?
@user.name
elsif @user.respond_to?(:email) && @user.email.present?
@user.email
elsif @user.respond_to?(:email_address) && @user.email_address.present?
@user.email_address
else
"Avo user"
end
end
|
65
66
67
68
69
|
# File 'app/components/avo/sidebar_profile_component.rb', line 65
def
return false unless Avo.plugin_manager.installed?("avo-menu")
custom_profile_component.render?
end
|
#sign_out_method ⇒ Object
40
41
42
|
# File 'app/components/avo/sidebar_profile_component.rb', line 40
def sign_out_method
:delete
end
|
#sign_out_path ⇒ Object
44
45
46
47
48
49
|
# File 'app/components/avo/sidebar_profile_component.rb', line 44
def sign_out_path
return Avo.configuration.sign_out_path_name if Avo.configuration.sign_out_path_name.present?
return :session_path if helpers.possibly_rails_authentication?
default_sign_out_path
end
|
#title ⇒ Object
28
29
30
31
32
33
34
|
# File 'app/components/avo/sidebar_profile_component.rb', line 28
def title
if @user.respond_to?(:avo_title) && @user.avo_title.present?
@user.avo_title
else
""
end
end
|