Module: Pxs::Forms::LinksHelper

Includes:
ActionView::Helpers::UrlHelper
Included in:
ModelFormBuilder, ModelsHelper
Defined in:
lib/pxs/forms/links_helper.rb

Instance Method Summary collapse

Instance Method Details

a button that makes an HTML request



18
19
20
# File 'lib/pxs/forms/links_helper.rb', line 18

def link_button_to(text, target, options = {})
    link_to text, target, class: merge_option(:class, "button", options)[:class], method: options[:method] || :get, id: options[:id], title: options[:title], data: options[:data]
end

a button that triggers a turbo request



12
13
14
15
# File 'lib/pxs/forms/links_helper.rb', line 12

def turbo_link_button(text, target, options = {})
    # inject the button class to a turbo link
    turbo_link_to text, target, merge_option(:class, "button", options)
end

a link that triggers a turbo request



7
8
9
# File 'lib/pxs/forms/links_helper.rb', line 7

def turbo_link_to(text, target, options = {})
    link_to text, target, class: options[:class] || nil, data: { turbo_stream: true, turbo_method: options[:method] || :get, turbo_confirm: options[:confirm] }.merge(options[:data] || {}), id: options[:id], title: options[:title]
end