aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-03-06 18:53:45 +0000
committerfrancis <francis>2008-03-06 18:53:45 +0000
commit91cbd62a0322d019f5ebcf88784b9fcd668b23c5 (patch)
treea92af69fda858e76d87cf60bdfb9044bd1466132
parent8ea95ccb917ebf804599f61d720a66d62dbe46ec (diff)
And apply pagination fix via Monkeypatch instead.
-rw-r--r--config/environment.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/config/environment.rb b/config/environment.rb
index d79f52539..e8898cf39 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -149,3 +149,23 @@ module ActsAsSolr
end
end
+# Monkeypatch! Hack for admin pages, when proxied via https on mySociety servers, they
+# 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)
+ end
+ end
+ end
+ end
+end
+