Module: ActsAsExportable::ViewHelper
- Includes:
- ActionDispatch::Routing::UrlFor, ActionView::Helpers::TagHelper
- Defined in:
- lib/acts_as_exportable/view_helper.rb
Instance Method Summary collapse
-
#link_to_export(*args) ⇒ Object
Download csv Link.
Instance Method Details
#link_to_export(*args) ⇒ Object
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] = args[1] || {} = args[2] url = "export?class_name=#{class_name}" = (, ) = () href_attr = "href=\"#{url}\"" "<a #{href_attr}#{}>#{html_escape(name || url)}</a>".html_safe end |