         for id, item of @selectedItemsIndex
           @moveAnimalsModal.animals.push item
 
-        Turbolinks.visit @animal_moving_url
+        E.dialog.open @animal_moving_url,
+          returns:
+            success: (frame, data, status, request) ->
+              frame.dialog "close"
+              return
+
+            invalid: (frame, data, status, request) ->
+              frame.html request.responseText
+              return
+
 
 #        @moveAnimalsModal.show(true)
 

        animals_ids: Object.keys(app.selectedItemsIndex)
      })}"

    #TODO call modal to directly add a new intervention instead of redirect
    Turbolinks.visit link
    false



#= require bootstrap/modal

((E, G, $) ->

  $(document).ajaxSend (e, xhr, options) ->
    token = $('meta[name=\'csrf-token\']').attr('content')
