Module: LiveComponent::ApplicationHelper

Defined in:
app/helpers/live_component/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#button_to(*args, rerender: nil, form: {}, **options, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/helpers/live_component/application_helper.rb', line 19

def button_to(*args, rerender: nil, form: {}, **options, &block)
  if (params = Utils.html_params_for_rerender(rerender))
    form.merge!(params)
  end

  options = ::LiveComponent::Utils.translate_all_attrs(options)

  super(*args, **options, form: form, &block)
end

#content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/live_component/application_helper.rb', line 29

def (name, content_or_options_with_block = nil, options = nil, escape = true, &block)
  if block_given?
    if content_or_options_with_block.is_a?(Hash)
      options = content_or_options_with_block
      content_or_options_with_block = nil
    end
  end

  options ||= {}
  options = ::LiveComponent::Utils.translate_all_attrs(options)

  super
end

#form_with(rerender: nil, html: {}, **options, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'app/helpers/live_component/application_helper.rb', line 9

def form_with(rerender: nil, html: {}, **options, &block)
  if (params = Utils.html_params_for_rerender(rerender))
    html.merge!(params)
  end

  options = ::LiveComponent::Utils.translate_all_attrs(options)

  super(**options, html: html, &block)
end

#liveObject



5
6
7
# File 'app/helpers/live_component/application_helper.rb', line 5

def live
  @__lc_tag_builder ||= LiveComponent::TagBuilder.new(self)
end