Class: ProductTours::Configuration
- Inherits:
-
Object
- Object
- ProductTours::Configuration
- Defined in:
- lib/product_tours/configuration.rb
Constant Summary collapse
- DEFAULT_ADMIN_LAYOUT =
The gem's own dashboard layout. Compared against, so DashboardController can tell "the host left this alone" from "the host chose this".
'product_tours/application'
Instance Attribute Summary collapse
-
#admin_layout ⇒ Object
Returns the value of attribute admin_layout.
-
#authorize_admin ⇒ Object
Returns the value of attribute authorize_admin.
-
#base_controller_class ⇒ Object
The controller the DASHBOARD inherits from, as a String so it resolves lazily rather than at config time.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#mount_path ⇒ Object
Returns the value of attribute mount_path.
-
#storage_service ⇒ Object
Returns the value of attribute storage_service.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #widget_endpoint ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 |
# File 'lib/product_tours/configuration.rb', line 27 def initialize @enabled = ->(_request) { true } @authorize_admin = ->(_request) { Rails.env.development? } @admin_layout = DEFAULT_ADMIN_LAYOUT @base_controller_class = 'ActionController::Base' @mount_path = '/product_tours' @storage_service = nil end |
Instance Attribute Details
#admin_layout ⇒ Object
Returns the value of attribute admin_layout.
9 10 11 |
# File 'lib/product_tours/configuration.rb', line 9 def admin_layout @admin_layout end |
#authorize_admin ⇒ Object
Returns the value of attribute authorize_admin.
9 10 11 |
# File 'lib/product_tours/configuration.rb', line 9 def @authorize_admin end |
#base_controller_class ⇒ Object
The controller the DASHBOARD inherits from, as a String so it resolves
lazily rather than at config time. Default: a plain
'ActionController::Base', where authorize_admin is the only gate.
Name the controller your own admin already inherits from and the dashboard
adopts that whole stack — layout, helpers, authentication, and any request
context your before_actions set up. admin_layout covers only the layout,
which leaves a host layout calling its own helpers to raise NameError under
the engine's isolated namespace.
Only the dashboard uses it. The widget's endpoints stay on the engine's own public controller, so an admin base controller here can never demand a staff session from a visitor being shown a tour.
25 26 27 |
# File 'lib/product_tours/configuration.rb', line 25 def base_controller_class @base_controller_class end |
#enabled ⇒ Object
Returns the value of attribute enabled.
9 10 11 |
# File 'lib/product_tours/configuration.rb', line 9 def enabled @enabled end |
#mount_path ⇒ Object
Returns the value of attribute mount_path.
9 10 11 |
# File 'lib/product_tours/configuration.rb', line 9 def mount_path @mount_path end |
#storage_service ⇒ Object
Returns the value of attribute storage_service.
9 10 11 |
# File 'lib/product_tours/configuration.rb', line 9 def storage_service @storage_service end |
Instance Method Details
#widget_endpoint ⇒ Object
36 |
# File 'lib/product_tours/configuration.rb', line 36 def = "#{mount_path.to_s.chomp('/')}/widget" |