class RecordingControlsView < Live::View
- Inherits from
Live::View
The persistent narration controls nested within class Presently::RecorderView.
Definitions
def initialize(id, data, controller:)
Initialize the recording controls view.
Signature
-
parameter
idString The stable element identifier.
-
parameter
dataHash The element data attributes.
-
parameter
controllerPresentationController The shared presentation controller.
Implementation
def initialize(id, data, controller:)
super(id, data)
@controller = controller
end
def tag_name
Use the client-side recorder as this live view's custom element.
Implementation
def tag_name
"presently-recording-controls"
end
def build_markup(builder)
Render the recorder host. Its shadow DOM owns the controls themselves.
Signature
-
parameter
builderXRB::Builder The HTML builder.
Implementation
def build_markup(builder)
slide = @controller.current_slide
return unless slide
index = @controller.current_index
recording_present = @controller.recording_available?(slide)
builder.inline_tag(tag_name,
id: @id,
data: @data,
"data-slide-index": index,
"data-recording-url": "/recordings?index=#{index}",
"data-slide-duration": slide.duration,
"data-recording-state": recording_present ? "present" : "missing"
)
end