Commit 1ffc0d1b406982f280c8717d573bb1528bace621
1 parent
41803288
Exists in
master
and in
29 other branches
pjax: fix use with asset pipeline
Showing
2 changed files
with
6 additions
and
6 deletions
Show diff stats
plugins/pjax/public/javascripts/pjax.js
@@ -8,7 +8,7 @@ pjax = { | @@ -8,7 +8,7 @@ pjax = { | ||
8 | themes: {}, | 8 | themes: {}, |
9 | 9 | ||
10 | load: function() { | 10 | load: function() { |
11 | - var target = jQuery('#content'); | 11 | + var target = jQuery('#wrap-1'); |
12 | var content = jQuery('#content-inner'); | 12 | var content = jQuery('#content-inner'); |
13 | var loadingTarget = jQuery('#content'); | 13 | var loadingTarget = jQuery('#content'); |
14 | 14 | ||
@@ -52,7 +52,7 @@ pjax = { | @@ -52,7 +52,7 @@ pjax = { | ||
52 | from_state = this.current_state || this.initial_state; | 52 | from_state = this.current_state || this.initial_state; |
53 | 53 | ||
54 | if (state.layout_template != from_state.layout_template) { | 54 | if (state.layout_template != from_state.layout_template) { |
55 | - var lt_css = jQuery('head link[href^="/designs/templates"]'); | 55 | + var lt_css = jQuery('head link[href*="designs/templates"]'); |
56 | lt_css.attr('href', lt_css.attr('href').replace(/templates\/.+\/stylesheets/, 'templates/'+state.layout_template+'/stylesheets')); | 56 | lt_css.attr('href', lt_css.attr('href').replace(/templates\/.+\/stylesheets/, 'templates/'+state.layout_template+'/stylesheets')); |
57 | } | 57 | } |
58 | 58 | ||
@@ -78,7 +78,7 @@ pjax = { | @@ -78,7 +78,7 @@ pjax = { | ||
78 | return !pjax.css_loaded('/designs/themes/'+state.theme.id+'/style.css'); | 78 | return !pjax.css_loaded('/designs/themes/'+state.theme.id+'/style.css'); |
79 | }); | 79 | }); |
80 | 80 | ||
81 | - var css = jQuery('head link[href^="/designs/themes/'+from_state.theme.id+'/style"]'); | 81 | + var css = jQuery('head link[href*="designs/themes/'+from_state.theme.id+'/style"]'); |
82 | css.attr('href', css.attr('href').replace(/themes\/.+\/style/, 'themes/'+state.theme.id+'/style')); | 82 | css.attr('href', css.attr('href').replace(/themes\/.+\/style/, 'themes/'+state.theme.id+'/style')); |
83 | 83 | ||
84 | jQuery('head link[rel="shortcut icon"]').attr('href', state.theme.favicon); | 84 | jQuery('head link[rel="shortcut icon"]').attr('href', state.theme.favicon); |
@@ -88,7 +88,7 @@ pjax = { | @@ -88,7 +88,7 @@ pjax = { | ||
88 | jQuery('#navigation ul').html(state.theme.extra_navigation); | 88 | jQuery('#navigation ul').html(state.theme.extra_navigation); |
89 | jQuery('#theme-footer').html(state.theme.footer); | 89 | jQuery('#theme-footer').html(state.theme.footer); |
90 | 90 | ||
91 | - jQuery('head script[src^="/designs/themes/'+from_state.theme.id+'/theme.js"]').remove(); | 91 | + jQuery('head script[src*="designs/themes/'+from_state.theme.id+'/theme.js"]').remove(); |
92 | if (state.theme.js_src) { | 92 | if (state.theme.js_src) { |
93 | var script = document.createElement('script'); | 93 | var script = document.createElement('script'); |
94 | script.type = 'text/javascript', script.src = state.theme.js_src; | 94 | script.type = 'text/javascript', script.src = state.theme.js_src; |
plugins/pjax/views/layouts/pjax.html.erb
1 | <% | 1 | <% |
2 | - update_js = render(:file => "#{Rails.root}/public/designs/themes/#{current_theme}/pjax_update.js.erb").to_json rescue nil | 2 | + update_js = render(file: "#{Rails.root}/public/designs/themes/#{current_theme}/pjax_update.js.erb").to_json rescue nil |
3 | %> | 3 | %> |
4 | 4 | ||
5 | <title><%= h page_title %></title> | 5 | <title><%= h page_title %></title> |
6 | 6 | ||
7 | -<%= render :file => "#{Rails.root}/public/designs/themes/#{current_theme}/layouts/_content.html.erb" rescue | 7 | +<%= render file: "#{Rails.root}/public/designs/themes/#{current_theme}/layouts/_content.html.erb" rescue |
8 | render "layouts/content" %> | 8 | render "layouts/content" %> |
9 | 9 | ||
10 | <%= javascript_tag do %> | 10 | <%= javascript_tag do %> |