Module: KpopHelper
- Defined in:
- app/helpers/kpop_helper.rb
Instance Method Summary collapse
-
#kpop_button_close(content = nil, &block) ⇒ Object
Renders a button that will close the current kpop modal, if any.
-
#kpop_button_to(name = nil, options = nil, html_attributes = nil) ⇒ Object
Renders a button that will navigate the kpop turbo frame to the given URL.
-
#kpop_link_to(name = nil, options = nil, html_attributes = nil, &block) ⇒ Object
Renders a link that will navigate the kpop turbo frame to the given URL.
Instance Method Details
#kpop_button_close(content = nil, &block) ⇒ Object
Renders a button that will close the current kpop modal, if any.
28 29 30 31 |
# File 'app/helpers/kpop_helper.rb', line 28 def (content = nil, **, &block) content = capture(yield) if block tag.(content, data: { action: "click->kpop--frame#dismiss:prevent" }, **) end |
#kpop_button_to(name = nil, options = nil, html_attributes = nil) ⇒ Object
Renders a button that will navigate the kpop turbo frame to the given URL. The URL should render a modal response inside a kpop frame tag.
20 21 22 23 24 25 |
# File 'app/helpers/kpop_helper.rb', line 20 def (name = nil, = nil, html_attributes = nil, &) default_html_attributes = { form: { data: { turbo_frame: "kpop" } }, } (name, , default_html_attributes.deep_merge_html_attributes(html_attributes || {}), &) end |
#kpop_link_to(name = nil, options = nil, html_attributes = nil, &block) ⇒ Object
Renders a link that will navigate the kpop turbo frame to the given URL. The URL should render a modal response inside a kpop frame tag.
8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/kpop_helper.rb', line 8 def kpop_link_to(name = nil, = nil, html_attributes = nil, &block) default_html_attributes = { data: { turbo_frame: "kpop" } } if block # Param[name] is the path for the link link_to(name, default_html_attributes.deep_merge_html_attributes( || {}), &block) else link_to(name, , default_html_attributes.deep_merge_html_attributes(html_attributes || {})) end end |