Class: NeonSakura::Configuration
- Inherits:
-
Object
- Object
- NeonSakura::Configuration
- Defined in:
- lib/neon_sakura/configuration.rb
Instance Attribute Summary collapse
-
#app_icon ⇒ Object
Returns the value of attribute app_icon.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#available_themes ⇒ Object
Returns the value of attribute available_themes.
-
#default_theme ⇒ Object
Returns the value of attribute default_theme.
-
#enable_error_pages ⇒ Object
Returns the value of attribute enable_error_pages.
-
#enable_style_guide ⇒ Object
Returns the value of attribute enable_style_guide.
-
#enable_theme_persistence ⇒ Object
Returns the value of attribute enable_theme_persistence.
-
#login_logo ⇒ Object
Returns the value of attribute login_logo.
-
#nav_links ⇒ Object
Returns the value of attribute nav_links.
-
#nav_position ⇒ Object
Returns the value of attribute nav_position.
-
#show_header ⇒ Object
Returns the value of attribute show_header.
-
#show_search ⇒ Object
Returns the value of attribute show_search.
-
#show_version ⇒ Object
Returns the value of attribute show_version.
-
#sticky_navbar ⇒ Object
Returns the value of attribute sticky_navbar.
-
#style_guide_navbar_position ⇒ Object
Returns the value of attribute style_guide_navbar_position.
-
#style_guide_pagy_examples ⇒ Object
Returns the value of attribute style_guide_pagy_examples.
-
#theme_api_endpoint ⇒ Object
Returns the value of attribute theme_api_endpoint.
-
#version_module ⇒ Object
Returns the value of attribute version_module.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#inject_style_guide_link! ⇒ Object
Auto-inject style guide link into nav_links Called by engine initializer in development/test environments.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/neon_sakura/configuration.rb', line 11 def initialize @app_name = "My Application" @show_version = true @show_header = true @enable_error_pages = true @nav_position = :under_heading @app_icon = nil @show_search = false @version_module = nil # Optional module that provides .commit_hash (e.g., YourApp::Version) # Login page logo configuration (v0.1.6+) @login_logo = { icon: nil, # Icon name (e.g., "artemis_logo", "auth_banner", or nil) css_class: "w-12 h-12 sm:w-16 sm:h-16", # Default responsive size for login logos gradient_id: nil # Optional gradient ID for icons that support it } @nav_links = [ { name: "Home", path: "/" }, { name: "About", path: "/about" } ] # Theme configuration (v0.1.1+) # By default, all 4 themes are available @default_theme = { name: "purple", mode: "dark" } @available_themes = [ { name: "green", mode: "light", label: "Green Light" }, { name: "green", mode: "dark", label: "Green Dark" }, { name: "purple", mode: "light", label: "Purple Light" }, { name: "purple", mode: "dark", label: "Purple Dark" } ] @enable_theme_persistence = true @theme_api_endpoint = nil # Style guide configuration (v0.1.3+) @enable_style_guide = true @style_guide_navbar_position = :end @style_guide_pagy_examples = true # Auto-detect: show if Pagy available, skip if not # Navbar configuration @sticky_navbar = false # Off by default for backward compatibility end |
Instance Attribute Details
#app_icon ⇒ Object
Returns the value of attribute app_icon.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def app_icon @app_icon end |
#app_name ⇒ Object
Returns the value of attribute app_name.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def app_name @app_name end |
#available_themes ⇒ Object
Returns the value of attribute available_themes.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def available_themes @available_themes end |
#default_theme ⇒ Object
Returns the value of attribute default_theme.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def default_theme @default_theme end |
#enable_error_pages ⇒ Object
Returns the value of attribute enable_error_pages.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def enable_error_pages @enable_error_pages end |
#enable_style_guide ⇒ Object
Returns the value of attribute enable_style_guide.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def enable_style_guide @enable_style_guide end |
#enable_theme_persistence ⇒ Object
Returns the value of attribute enable_theme_persistence.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def enable_theme_persistence @enable_theme_persistence end |
#login_logo ⇒ Object
Returns the value of attribute login_logo.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def login_logo @login_logo end |
#nav_links ⇒ Object
Returns the value of attribute nav_links.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def nav_links @nav_links end |
#nav_position ⇒ Object
Returns the value of attribute nav_position.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def nav_position @nav_position end |
#show_header ⇒ Object
Returns the value of attribute show_header.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def show_header @show_header end |
#show_search ⇒ Object
Returns the value of attribute show_search.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def show_search @show_search end |
#show_version ⇒ Object
Returns the value of attribute show_version.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def show_version @show_version end |
#sticky_navbar ⇒ Object
Returns the value of attribute sticky_navbar.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def @sticky_navbar end |
#style_guide_navbar_position ⇒ Object
Returns the value of attribute style_guide_navbar_position.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def @style_guide_navbar_position end |
#style_guide_pagy_examples ⇒ Object
Returns the value of attribute style_guide_pagy_examples.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def style_guide_pagy_examples @style_guide_pagy_examples end |
#theme_api_endpoint ⇒ Object
Returns the value of attribute theme_api_endpoint.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def theme_api_endpoint @theme_api_endpoint end |
#version_module ⇒ Object
Returns the value of attribute version_module.
5 6 7 |
# File 'lib/neon_sakura/configuration.rb', line 5 def version_module @version_module end |
Instance Method Details
#inject_style_guide_link! ⇒ Object
Auto-inject style guide link into nav_links Called by engine initializer in development/test environments
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 84 85 86 |
# File 'lib/neon_sakura/configuration.rb', line 55 def inject_style_guide_link! return unless enable_style_guide return unless Rails.env.development? || Rails.env.test? # Don't inject twice return if nav_links.any? { |link| link[:path] == "/style-guide" } style_guide_link = { type: "link", name: "Style Guide", path: "/style-guide", icon: "palette", condition: "Rails.env.development? || Rails.env.test?", aria_label: "View style guide" } case when :start nav_links.unshift(style_guide_link) when :before_logout logout_index = nav_links.find_index { |link| link[:type] == "button" } if logout_index nav_links.insert(logout_index, style_guide_link) else nav_links << style_guide_link end when Integer nav_links.insert(, style_guide_link) else # :end or default nav_links << style_guide_link end end |