The project I'm working on renders several pages (such as login pages and signup forms) as modals, which is accomplished by giving those links the class .modal so the following piece of JavaScript would trigger:
$('.modal').click(function(){
var url = this.href;
var dialog = $('<div id="modal" style="display:none"></div>').prepend('#barhappy_container');
dialog.load(url, function(){
dialog.dialog({
modal: true,
draggable: false,
position: 'center',
dialogClass: 'no-title',
width: 'auto',
/* height: 'auto', */
resizable: false,
open: function(){
$.getScript('/assets/modal/in-modal-open.js');
},
close: function(event, ui){
dialog.remove();
}
});
});
return false;
});
However, I now need a page rendered by a Controller to display the same way, but there's no link to click that can be given the class .modal.
So, is there a way to call this JavaScript function from my Rails controller and pass it the proper parameters?