diff --git a/test_app/app/assets/javascripts/application.js b/test_app/app/assets/javascripts/application.js index 79605af..224d3cc 100644 --- a/test_app/app/assets/javascripts/application.js +++ b/test_app/app/assets/javascripts/application.js @@ -52,3 +52,16 @@ Foos.prototype.otherAction = function(){}; var NotFoos = Paloma.controller('NotAdmin/Foos'); NotFoos.prototype.show = function(){}; NotFoos.prototype.otherAction = function(){}; + + +$(document).ready(function(){ + $('#js-ajax-link').on('click', function(e){ + e.preventDefault(); + + $.get($(this).prop('href'), function(response){ + $('#js-ajax-response').html(response); + Paloma.executeHook(); + Paloma.engine.start(); + }); + }); +}); diff --git a/test_app/app/controllers/main_controller.rb b/test_app/app/controllers/main_controller.rb index 047d481..0649a0b 100644 --- a/test_app/app/controllers/main_controller.rb +++ b/test_app/app/controllers/main_controller.rb @@ -40,6 +40,11 @@ class MainController < ApplicationController end + def ajax + render :ajax, :layout => false + end + + diff --git a/test_app/app/views/layouts/application.html.erb b/test_app/app/views/layouts/application.html.erb index cc6218b..e749b21 100644 --- a/test_app/app/views/layouts/application.html.erb +++ b/test_app/app/views/layouts/application.html.erb @@ -19,11 +19,15 @@