Class: RedmineExtensions::Export::EasyOtherFormatsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine_extensions/export/easy_other_formats_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ EasyOtherFormatsBuilder

Returns a new instance of EasyOtherFormatsBuilder.



4
5
6
# File 'lib/redmine_extensions/export/easy_other_formats_builder.rb', line 4

def initialize(view)
  @view = view
end

Instance Method Details

name, query, options



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/redmine_extensions/export/easy_other_formats_builder.rb', line 13

def link_to(name, *args)
  options = args.extract_options!
  format = name.to_s.downcase
  query = args.shift
  url = options.delete(:url) || {}
  url.stringify_keys!

  params = @view.params.except('page', 'controller', 'action').merge(:format => format)
  if query && url.blank?
    url = query.path(params)
  else
    url = params.merge(url)
  end
  caption = options.delete(:caption) || name
  html_options = { :class => format, :rel => 'nofollow' }.merge(options)
  @view.('span', @view.link_to(caption, url, html_options))
end