Created
May 5, 2012 05:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- pjax.orig.rb 2012-05-04 22:46:22.000000000 -0700 | |
+++ pjax.rb 2012-05-04 22:46:57.000000000 -0700 | |
@@ -13,6 +13,10 @@ | |
headers = HeaderHash.new(headers) | |
if pjax?(env) | |
+ request_parameters = env['action_dispatch.request.parameters'] | |
+ controller_name = request_parameters[:controller] | |
+ action_name = request_parameters['action'] | |
+ | |
new_body = "" | |
body.each do |b| | |
parsed_body = Hpricot.XML(b) | |
@@ -22,6 +26,13 @@ | |
new_body << title.to_s if title | |
new_body << container.inner_html | |
+ new_body << <<-EOS | |
+ <script type="text/javascript"> | |
+ $('body').removeClass(); | |
+ $('body').addClass('#{controller_name}'); | |
+ $('body').attr('id', '#{action_name}'); | |
+ </script> | |
+ EOS | |
else | |
new_body << b | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment