I currently have a page template that initially renders a partial. On a button click, I'm replacing that partial with a different partial using ajax; however, the new partial has uses the "container" page helper. When it renders the new partial I get a "undefined method `container' " error. Below is some code:
layouts/templates/careers.html.erb
<%= render 'partials/header' %>
<%= render 'partials/careers_header' %>
<div class="ajax-container">
<div class="ajax-inner">
<%= render 'careers/cultures' %> #this is the initial partial in question
</div>
</div>
<%= render 'partials/footer' %>
config/routes.rb
...
get '/careers/:section', to: 'careers#section'
...
controllers/careers_controller.rb
class CareersController < ApplicationController
def section
@section = params[:section]
respond_to do |format|
format.js
end
end
end
views/careers/section.js.erb
$('.ajax-inner').addClass('off-page');
setTimeout(function(){
$('.ajax-inner').remove();
$('.ajax-container').append('<div class="ajax-inner off-page"></div>');
//renders the partial based on the instance variable passed in from the Careers controller
$('.ajax-inner').html("<%= escape_javascript(render :partial => @section)%>");
}, 300);
setTimeout(function(){
$('.ajax-inner').removeClass('off-page');
}, 600);
This all works well and good. I get a nice page transition when the content gets swapped out. However, when I try to include:
I'm using Browser CMS v. 3.5
I currently have a page template that initially renders a partial. On a button click, I'm replacing that partial with a different partial using ajax; however, the new partial has uses the "container" page helper. When it renders the new partial I get a "undefined method `container' " error. Below is some code:
layouts/templates/careers.html.erb
config/routes.rb
controllers/careers_controller.rb
views/careers/section.js.erb
This all works well and good. I get a nice page transition when the content gets swapped out. However, when I try to include:
i get the "undefined method `container' "
Help?