Module: ActsAsExportable::ViewHelper

Includes:
ActionDispatch::Routing::UrlFor, ActionView::Helpers::TagHelper
Defined in:
lib/acts_as_exportable/view_helper.rb

Instance Method Summary collapse

Instance Method Details

Download csv Link

Link_to_export “Link Text”, “Contact”, :id => “contact-button” <a href=“export/index?class_name=Contact” id=“contact-button”>Link Text</a>



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/acts_as_exportable/view_helper.rb', line 12

def link_to_export(*args)
  name         = args[0]
  class_name   = args[1]
  options      = args[1] || {}
  html_options = args[2]
  url = "export?class_name=#{class_name}"

  html_options = convert_options_to_data_attributes(options, html_options)
  tag_options = tag_options(html_options)

  href_attr = "href=\"#{url}\""

  "<a #{href_attr}#{tag_options}>#{html_escape(name || url)}</a>".html_safe
end