Module: Lesli::TurboHelper

Defined in:
app/helpers/lesli/turbo_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_form_stream(partial_path, locals = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/helpers/lesli/turbo_helper.rb', line 41

def render_form_stream(partial_path, locals = {})

    # Detect the current engine's namespace
    engine_name = controller.class.module_parent_name.underscore

    # Ensure the correct namespace is applied (only if not already present)
    partial_path = "#{engine_name}/#{partial_path}"

    # Convert the partial path to a valid DOM ID
    partial_id = partial_path.tr("/", "-").tr("_", "-")

    # Renders the stream to update the partial
    turbo_stream.replace(partial_id) do
        render(partial_path, locals)
    end
end

#render_notifications_streamObject



35
36
37
38
39
# File 'app/helpers/lesli/turbo_helper.rb', line 35

def render_notifications_stream
    turbo_stream.replace("application-lesli-notifications") do
        render("lesli/partials/application-lesli-notifications")
    end
end