<%= javascript_tag do %>
  // TODO: non-intrusive Javascript
  function toggle_accept_reject() {
    $('#rejectBox').toggle(); $('#acceptBox').toggle();
  }
<% end %>

<div id="acceptBox">
  <h3>Accept application</h3>
  <%= form_for @cinstance, :url => accept_admin_buyers_application_path(@cinstance), :html => {:class => :standard, :method => :put} do |f| %>
      <div class="field">
        <%= f.submit 'Accept' %>
        or
        <%= link_to 'Reject', '#', onclick: 'toggle_accept_reject()' %>
      </div>
  <% end %>
</div>

<div id="rejectBox" style="display: none;">
  <h3>Reject application</h3>
  <%= form_for @cinstance, :url => reject_admin_buyers_application_path(@cinstance), :html => {:class => :standard, :method => :delete} do |f| %>
    <label>
      Reason for rejection? (to be appended to message dispatched to user)
    </label>
    <div class="field">
      <%= text_area_tag :reason, nil, :class => :short, :cols => 30, :rows => 5 %>
    </div>
    <div>
      <%= link_to 'Accept', '#', onclick: 'toggle_accept_reject()' %>
      or
      <%= f.submit 'Reject' %>
    </div>
  <% end %>
</div>
