.row .col.s12 .card-panel %h5= t('.invite_user') = simple_form_for User.new, url: invitation_path('user'), html: {method: :post} do |f| = devise_error_messages! %input{ type: 'hidden', name: 'user[account_id]', value: account_id } .form-inputs .row .input-field.col.s12 = f.input :name, class: :validate, autofocus: true .row .input-field.col.s12 = f.input :email, class: :validate .form-actions.right-align = f.button :submit, t('.invite_user_submit') :coffeescript $ -> $(document.body).on 'click', 'input[name="commit"]', (e) -> e.preventDefault() e.stopPropagation() $form = $(e.target).closest('form') data = $form.serialize() jqxhr = $.ajax url: '/users/invitation.js', type: 'post', data: data .done (response) -> $('#account_users').append(response) fadeItOut $('.message_container .alert-success') .fail (response) -> $('body').append(response.responseText) fadeItOut $('.message_container .alert-danger'), 5000