aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-09-04 08:49:33 +0000
committerfrancis <francis>2008-09-04 08:49:33 +0000
commita48eb26f47c8f68e4a0a43afe274df78e54743c6 (patch)
tree6ec23f93d997b8dc8d3d0ee3a50636349e209aab
parentbc25f87cb0e204b00f1ef6e4cf4dc249643437d3 (diff)
Update WillPaginate patch for relative admin URLs
-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