Problems with wiselinks and turbolinks

-1

I need that, after clicking a button, a modal appears, within that modal there is a populated form (or not) with rails objects. The problem is that I can not change the accept header to js so that rails render (not printe the code on the screen but rather execute) a .js.erb. To resolve this, I decided to put a data-remote=true in the button so that .js.erb was executed but the page was not reloaded, however I need to change the url and so I wanted to use wiselinks with the data-push=true attribute, but the two together does not work. Can someone help me with the modal problem or can you help me with how I do the modal appear with the remote and change the url with pushState ???

PS. the ideal would be that when clicking the button the modal appeared (with the content under the previous action) and when accessing the url directly the modal was also rendered (with a content of another action underneath)

    
asked by anonymous 11.03.2014 / 04:18

1 answer

1

You can create a function that shows the modal, download the object's JSON and do this via JS:

function mostraModal(obj) {
  alert('Objeto: ' + obj.nome);
}

Of course, instead of alert() you can use some more elaborate plugin, using HTML, etc.

    
12.05.2014 / 13:59