created at and url

This commit is contained in:
Rimian Perkins 2019-09-14 14:20:16 +10:00
parent 6fe149c4a5
commit 5c33268477
5 changed files with 17 additions and 14 deletions

View File

@ -1,5 +1,9 @@
# frozen_string_literal: true
class PaymentSerializer < ApplicationSerializer
attributes :payment_intent_id, :receipt_email, :url, :amount
attributes :payment_intent_id, :receipt_email, :url, :created_at_age, :amount
def created_at_age
Time.now - object.created_at
end
end

View File

@ -0,0 +1,5 @@
export default Ember.Helper.helper(function(params) {
const payment = params[0];
return `<a href=\"${payment.url}\">${payment.payment_intent_id}</a>`;
});

View File

@ -5,11 +5,6 @@ export default Discourse.Route.extend({
return ajax("/patrons/admin", {
method: "get"
})
.then(results => {
console.log(12, results);
return results;
});
.then(results => results);
}
});

View File

@ -5,18 +5,18 @@
<thead>
<tr>
<th>{{i18n 'discourse_patrons.admin.table.head.user'}}</th>
<th>{{i18n 'discourse_patrons.admin.table.head.payment_intent_id'}}</th>
<th>{{i18n 'discourse_patrons.admin.table.head.payment_intent'}}</th>
<th>{{i18n 'discourse_patrons.admin.table.head.receipt_email'}}</th>
<th>{{i18n 'discourse_patrons.admin.table.head.url'}}</th>
<th>{{i18n 'created'}}</th>
<th class="amount">{{i18n 'discourse_patrons.admin.table.head.amount'}}</th>
</tr>
</thead>
{{#each model as |payment|}}
<tr>
<td>{{payment.user_id}}</td>
<td>{{payment.payment_intent_id}}</td>
<td>{{{stripe-payment-link payment}}}</td>
<td>{{payment.receipt_email}}</td>
<td>{{payment.url}}</td>
<td>{{{format-duration payment.created_at_age}}}</td>
<td class="amount">{{payment.amount}}</td>
</tr>
{{/each}}

View File

@ -39,8 +39,7 @@ en:
admin:
table:
head:
url: User
payment_intent_id: Payment Intent Id
user: User
payment_intent: Payment Intent
receipt_email: Receipt Email
url: URL
amount: Amount