Skip to content

Instantly share code, notes, and snippets.

@adamjstevenson
Created October 22, 2017 18:44
Show Gist options
  • Save adamjstevenson/8565ee430ae60a55b465fd832efd7ad9 to your computer and use it in GitHub Desktop.
Save adamjstevenson/8565ee430ae60a55b465fd832efd7ad9 to your computer and use it in GitHub Desktop.
A rails payments view
<div class="row">
<div class="col-md-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Payment ID</th>
<th>Amount</th>
<th>Net</th>
<th>Created</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @payments.each do |payment| %>
<tr>
<td><%= link_to payment.source_transfer.source_transaction, charge_path(payment.source_transfer.source_transaction) %></td>
<td><%= number_to_currency(payment.amount/100) %></td>
<td><%= format_amount(payment.amount - payment.application_fee.amount) %></td>
<td><%= format_date(payment.created) %></td>
<td class="text-center">
<% if payment.refunded %>
<span class="text-danger">
<span class="fa fa-undo"></span> Refunded
</span>
<% else %>
<%= link_to "Refund", charge_path(payment.source_transfer.source_transaction), method: :delete, data: { confirm: "Are you sure you want to refund this charge?", disable_with: "<i class='fa fa-spinner fa-spin'></i> Refunding charge..." }, class: "btn btn-sm btn-block btn-custom btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment