mirror of
https://github.com/kbparagua/paloma
synced 2023-03-27 23:21:17 -04:00
Add manual test to AJAX request
This commit is contained in:
parent
c971ba5de7
commit
e212c79ca0
5 changed files with 25 additions and 0 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -40,6 +40,11 @@ class MainController < ApplicationController
|
|||
end
|
||||
|
||||
|
||||
def ajax
|
||||
render :ajax, :layout => false
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
<li><%= link_to 'Main#basic_params', basic_params_main_index_path %></li>
|
||||
<li><%= link_to 'Main#xml_response', xml_response_main_index_path %></li>
|
||||
<li><%= link_to 'Main#file_response', file_response_main_index_path %></li>
|
||||
<li><%= link_to 'Main#ajax', ajax_main_index_path, :id => 'js-ajax-link' %></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div id='js-ajax-response'>
|
||||
</div>
|
||||
|
||||
<%= yield %>
|
||||
<%= insert_paloma_hook %>
|
||||
|
||||
|
|
2
test_app/app/views/main/ajax.html.erb
Normal file
2
test_app/app/views/main/ajax.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h1>Main#AJAX</h1>
|
||||
<%= insert_paloma_hook %>
|
|
@ -12,6 +12,7 @@ TestApp::Application.routes.draw do
|
|||
get :js_response
|
||||
get :xml_response
|
||||
get :file_response
|
||||
get :ajax
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue