rubyforgood/babywearing

View on GitHub
app/views/carriers/loans/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_with model: @loan, url: carrier_loan_path(@carrier, @loan), method: :put, remote: request.xhr?, html: { data: { modal: true } } do |form| %>
  <div class="modal-body">
    <%= form_errors @loan %>

    <div style="background: #fbf6f4;border: 1px solid #d0cfcf;padding: 10px;">
      <%= tag.h5 "Loan for...", style: "color: #283c46" %>
      <p><em><%= @carrier.name %></em></p>
      <%= render partial: "carriers/details", locals: { carrier: @carrier } %>
    </div>

    <div class="form-group">
      <%= form.label :due_date %>
      <%= form.date_field :due_date, class: "form-control" %>
    </div>
    <div class="form-group">
      <%= form.label :returned_on  %>
      <%= form.date_field :returned_on, class: "form-control", include_blank: true %>
    </div>
    <div class="form-group">
      <%= form.label :notes %>
      <%= form.text_area :notes, class: "form-control", rows: 3 %>
    </div>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
    <%= form.submit "Submit", class: "btn btn-primary" %>
  </div>
<% end %>