Module: Protege::BroadcastableEmailDomain
- Extended by:
- ActiveSupport::Concern
- Included in:
- EmailDomain
- Defined in:
- app/models/concerns/protege/broadcastable_email_domain.rb
Overview
Drives real-time Turbo Stream broadcasting for EmailDomain records — keeping the Domains sidebar
live: the row is appended on create, replaced on update, and removed on destroy. First-page viewers
subscribe via turbo_stream_from "protege:email_domains" (see SidebarHelper#sidebar_stream).
Constant Summary collapse
- STREAM =
Turbo Stream channel for all
EmailDomainrecords. 'protege:email_domains'
Instance Method Summary collapse
-
#broadcast_email_domain_created ⇒ void
Append this domain's row to the Domains sidebar on creation.
-
#broadcast_email_domain_removed ⇒ void
Remove this domain's sidebar row on destruction.
-
#broadcast_email_domain_updated ⇒ void
Replace this domain's sidebar row in place when its attributes change.
Instance Method Details
#broadcast_email_domain_created ⇒ void
This method returns an undefined value.
Append this domain's row to the Domains sidebar on creation.
23 24 25 26 27 28 |
# File 'app/models/concerns/protege/broadcastable_email_domain.rb', line 23 def broadcast_email_domain_created broadcast_append_to STREAM, target: 'email_domains_list', partial: 'protege/email_domains/email_domain_sidebar_item', locals: { email_domain: self } end |
#broadcast_email_domain_removed ⇒ void
This method returns an undefined value.
Remove this domain's sidebar row on destruction.
43 44 45 46 |
# File 'app/models/concerns/protege/broadcastable_email_domain.rb', line 43 def broadcast_email_domain_removed broadcast_remove_to STREAM, target: ActionView::RecordIdentifier.dom_id(self) end |
#broadcast_email_domain_updated ⇒ void
This method returns an undefined value.
Replace this domain's sidebar row in place when its attributes change.
33 34 35 36 37 38 |
# File 'app/models/concerns/protege/broadcastable_email_domain.rb', line 33 def broadcast_email_domain_updated broadcast_replace_to STREAM, target: ActionView::RecordIdentifier.dom_id(self), partial: 'protege/email_domains/email_domain_sidebar_item', locals: { email_domain: self } end |