Module: Envoy::PageSurface
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/envoy/page_surface.rb
Overview
Declares which surface a page opens a chat against.
class TodayController < ApplicationController
envoy_surface :today, context_key: -> { "day:#{@date.to_fs(:iso8601)}" }
end
The context_key lambda is instance_exec'd in the controller, so instance variables set by the action are in scope. Pages that do not declare a surface get no bubble — opt-in by default.
Instance Method Summary collapse
-
#envoy_page_surface ⇒ Object
Nil when the controller never declared one — the layout renders nothing.
Instance Method Details
#envoy_page_surface ⇒ Object
Nil when the controller never declared one — the layout renders nothing.
26 27 28 29 30 31 32 |
# File 'lib/envoy/page_surface.rb', line 26 def envoy_page_surface config = envoy_surface_config return nil if config.nil? { surface: config[:key], context_key: config[:context_key] && instance_exec(&config[:context_key]) } end |