Class: Panda::Core::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/panda/core/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/panda/core/configuration.rb', line 29

def initialize
  @user_class = "Panda::Core::User"
  @user_identity_class = "Panda::Core::UserIdentity"
  @storage_provider = :active_storage
  @cache_store = :memory_store
  @parent_controller = "ActionController::API"
  @parent_mailer = "ActionMailer::Base"
  @mailer_sender = "support@example.com"
  @mailer_default_url_options = {host: "localhost:3000"}
  @session_token_cookie = :panda_session
  @authentication_providers = {}
  @admin_path = "/admin"
  @default_theme = "default"

  # Hook system for extending admin UI with sensible defaults
  @admin_navigation_items = ->(user) {
    items = [
      {
        label: "Dashboard",
        path: @admin_path,
        icon: "fa-solid fa-house"
      }
    ]

    # Add CMS navigation if available
    if defined?(Panda::CMS)
      items << {
        label: "Content",
        path: "#{@admin_path}/cms",
        icon: "fa-solid fa-file-lines"
      }
    end

    items << {
      label: "My Profile",
      path: "#{@admin_path}/my_profile/edit",
      icon: "fa-solid fa-user"
    }

    items
  }
  @admin_dashboard_widgets = ->(user) { [] }
  @user_attributes = []
  @user_associations = []
  @authorization_policy = ->(user, action, resource) { user.admin? }

  # Profile and UI customization
  @additional_user_params = []
  @available_themes = [["Default", "default"], ["Sky", "sky"]]
  @login_logo_path = nil
  @login_page_title = "Panda Admin"
  @admin_title = "Panda Admin"
  @initial_admin_breadcrumb = nil  # Proc that returns [label, path]
  @dashboard_redirect_path = nil  # Path to redirect to after login (defaults to admin_root_path)
end

Instance Attribute Details

#additional_user_paramsObject

Returns the value of attribute additional_user_params.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def additional_user_params
  @additional_user_params
end

#admin_dashboard_widgetsObject

Returns the value of attribute admin_dashboard_widgets.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def admin_dashboard_widgets
  @admin_dashboard_widgets
end

#admin_navigation_itemsObject

Returns the value of attribute admin_navigation_items.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def admin_navigation_items
  @admin_navigation_items
end

#admin_pathObject

Returns the value of attribute admin_path.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def admin_path
  @admin_path
end

#admin_titleObject

Returns the value of attribute admin_title.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def admin_title
  @admin_title
end

#authentication_providersObject

Returns the value of attribute authentication_providers.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def authentication_providers
  @authentication_providers
end

#authorization_policyObject

Returns the value of attribute authorization_policy.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def authorization_policy
  @authorization_policy
end

#available_themesObject

Returns the value of attribute available_themes.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def available_themes
  @available_themes
end

#cache_storeObject

Returns the value of attribute cache_store.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def cache_store
  @cache_store
end

#dashboard_redirect_pathObject

Returns the value of attribute dashboard_redirect_path.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def dashboard_redirect_path
  @dashboard_redirect_path
end

#default_themeObject

Returns the value of attribute default_theme.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def default_theme
  @default_theme
end

#initial_admin_breadcrumbObject

Returns the value of attribute initial_admin_breadcrumb.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def initial_admin_breadcrumb
  @initial_admin_breadcrumb
end

#login_logo_pathObject

Returns the value of attribute login_logo_path.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def 
  @login_logo_path
end

#login_page_titleObject

Returns the value of attribute login_page_title.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def 
  @login_page_title
end

#mailer_default_url_optionsObject

Returns the value of attribute mailer_default_url_options.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def mailer_default_url_options
  @mailer_default_url_options
end

#mailer_senderObject

Returns the value of attribute mailer_sender.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def mailer_sender
  @mailer_sender
end

#parent_controllerObject

Returns the value of attribute parent_controller.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def parent_controller
  @parent_controller
end

#parent_mailerObject

Returns the value of attribute parent_mailer.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def parent_mailer
  @parent_mailer
end

Returns the value of attribute session_token_cookie.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def session_token_cookie
  @session_token_cookie
end

#storage_providerObject

Returns the value of attribute storage_provider.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def storage_provider
  @storage_provider
end

#user_associationsObject

Returns the value of attribute user_associations.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def user_associations
  @user_associations
end

#user_attributesObject

Returns the value of attribute user_attributes.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def user_attributes
  @user_attributes
end

#user_classObject

Returns the value of attribute user_class.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def user_class
  @user_class
end

#user_identity_classObject

Returns the value of attribute user_identity_class.



4
5
6
# File 'lib/panda/core/configuration.rb', line 4

def user_identity_class
  @user_identity_class
end