$ -> role_selector = select_new_role: -> $("#role_id").on "change", (event) -> $.post "/home/role_change", { data: $("#role_id").val() }, (data) -> window.location.href = data.redirect init: -> role_selector.select_new_role() form_wizard = init: -> $("#new_user").formToWizard({ submitButton: 'save-account' }) ready = -> role_selector.init() form_wizard.init() # When using turbolinks $(document).on('page:load', ready) # otherwise ready()