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 # frozen_string_literal: true
class PaymentSerializer < ApplicationSerializer 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 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", { return ajax("/patrons/admin", {
method: "get" method: "get"
}) })
.then(results => { .then(results => results);
console.log(12, results);
return results;
});
} }
}); });

View File

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

View File

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