<h2>Send invitation</h2>

<%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post, :class => "form-horizontal"} do |f| %>
  <fieldset>
    <legend>
      Invitations left: <%= current_user.invitation_limit %>
    </legend>
    <%= devise_error_messages! %>

    <% if current_user.has_invitations_left? %>
      <div class="control-group well">
        <%= f.label :email, class: "control-label" %>
        <div class="controls">
          <%= f.text_field :email, class: "input-xlarge" %>
        </div>
      </div>

      <% content_for :personalized_message do %>
      <div class="control-group well">
        <%= f.label :message, class: "control-label" %>
        <div class="controls">
          <%= text_area :invite, :message, class: "input-xlarge", rows: 4 %>
        </div>
      </div>
      <% end %>

      <%= render 'users/mailer/invitation_text' %>


      <div class="form-actions">
        <%= f.submit "Send an invitation", class: "btn btn-primary" %>
      </div>
    <% end %>
  </fieldset>
<% end %>


<h2>Send invitation</h2>

<%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post, :class => "form-horizontal"} do |f| %>
  <fieldset>
    <legend>
      Invitations left: <%= current_user.invitation_limit %>
    </legend>
    <%= devise_error_messages! %>

    <% if current_user.has_invitations_left? %>
      <div class="control-group well">
        <%= f.label :email, class: "control-label" %>
        <div class="controls">
          <%= f.text_field :email, class: "input-xlarge" %>
        </div>
      </div>

      <% content_for :personalized_message do %>
      <div class="control-group well">
        <%= f.label :message, class: "control-label" %>
        <div class="controls">
          <%= text_area :invite, :message, class: "input-xlarge", rows: 4 %>
        </div>
      </div>
      <% end %>

      <%= render 'users/mailer/invitation_text' %>


      <div class="form-actions">
        <%= f.submit "Send an invitation", class: "btn btn-primary", disable_with: "Sending..." %>
      </div>
    <% end %>
  </fieldset>
<% end %>


Disable "Send an invitation"-button on click
Disable "Send an invitation"-button on click

Signed-off-by: tomdev <96835dd8bfa718bd6447ccc87af89ae1675daeca@codigy.nl>
