Complicated js.erb file with a lot of differents functions