Class: Redmine::Views::OtherFormatsBuilder
- Inherits:
-
Object
- Object
- Redmine::Views::OtherFormatsBuilder
- Defined in:
- lib/redmine/views/other_formats_builder.rb
Instance Method Summary collapse
-
#initialize(view) ⇒ OtherFormatsBuilder
constructor
A new instance of OtherFormatsBuilder.
- #link_to(name, options = {}) ⇒ Object
-
#link_to_with_query_parameters(name, url = {}, options = {}) ⇒ Object
Preserves query parameters.
Constructor Details
#initialize(view) ⇒ OtherFormatsBuilder
Returns a new instance of OtherFormatsBuilder.
23 24 25 |
# File 'lib/redmine/views/other_formats_builder.rb', line 23 def initialize(view) @view = view end |
Instance Method Details
#link_to(name, options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/redmine/views/other_formats_builder.rb', line 27 def link_to(name, ={}) url = {:format => name.to_s.downcase}.merge(.delete(:url) || {}).except('page') = .delete(:caption) || name = {:class => name.to_s.downcase, :rel => 'nofollow'}.merge() @view.content_tag('span', @view.link_to(, url, )) end |
#link_to_with_query_parameters(name, url = {}, options = {}) ⇒ Object
Preserves query parameters
35 36 37 38 39 40 41 42 |
# File 'lib/redmine/views/other_formats_builder.rb', line 35 def link_to_with_query_parameters(name, url={}, ={}) params = @view.request.query_parameters.except(:page, :format).except(*url.keys) url = {:params => params, :page => nil, :format => name.to_s.downcase}.merge(url) = .delete(:caption) || name = {:class => name.to_s.downcase, :rel => 'nofollow'}.merge() @view.content_tag('span', @view.link_to(, url, )) end |