Module: ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper
- Included in:
- ResourceController, ActiveAdmin::Views::PaginatedCollection
- Defined in:
- lib/active_admin/view_helpers/download_format_links_helper.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #build_download_format_links(formats = self.class.formats) ⇒ Object
- #build_download_formats(download_links) ⇒ Object
Instance Method Details
#build_download_format_links(formats = self.class.formats) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 17 def build_download_format_links(formats = self.class.formats) params = request.query_parameters.except :format, :commit div class: "download_links" do span I18n.t('active_admin.download') formats.each do |format| a format.upcase, href: url_for(params: params, format: format) end end end |
#build_download_formats(download_links) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 5 def build_download_formats(download_links) download_links = instance_exec(&download_links) if download_links.is_a?(Proc) if download_links.is_a?(Array) && !download_links.empty? download_links elsif download_links == false [] else self.class.formats end end |