aboutsummaryrefslogtreecommitdiffstats
path: root/config/environment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/environment.rb')
-rw-r--r--config/environment.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/config/environment.rb b/config/environment.rb
index 66bf33e77..d66f8ebfc 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -107,18 +107,12 @@ end
# need a relative URL.
module WillPaginate
class LinkRenderer
- def page_link_or_span(page, span_class, text)
- unless page
- @template.content_tag :span, text, :class => span_class
- else
- # page links should preserve GET/POST parameters
- if @template.params[:controller].match(/^admin_/)
- # XXX hack for admin pages, for mySociety HTTP proxy, use relative URL
- @template.link_to text, "?page=" + page.to_s
- else
- @template.link_to text, @template.params.merge(param => page != 1 ? page : nil)
+ def page_link(page, text, attributes = {})
+ url = url_for(page)
+ if url.match(/^\/admin.*(\?.*)/)
+ url = $1
end
- end
+ @template.link_to text, url, attributes
end
end
end