flip ordering

This commit is contained in:
Rimian Perkins 2019-09-15 22:03:42 +10:00
parent 18cf0e7f26
commit 910e08e4c9
4 changed files with 8 additions and 8 deletions

View File

@ -14,12 +14,12 @@ module DiscoursePatrons
if %w(created_at amount).include?(params[:order])
{ params[:order] => ascending }
else
{ created_at: :asc }
{ created_at: :desc }
end
end
def ascending
if params[:ascending] == 'false'
if params[:descending] == 'false'
:desc
else
:asc

View File

@ -42,7 +42,7 @@ module DiscoursePatrons
)
Payment.create(
user_id: response[:customer],
user_id: response[:metadata][:user_id],
payment_intent_id: response[:id],
receipt_email: response[:receipt_email],
url: response[:charges][:url],

View File

@ -1,14 +1,14 @@
export default Ember.Controller.extend({
queryParams: ["order", "ascending"],
queryParams: ["order", "descending"],
order: null,
ascending: true,
descending: true,
actions: {
loadMore() {},
orderPayments(order) {
if (order === this.get("order")) {
this.toggleProperty("ascending");
this.toggleProperty("descending");
}
this.set("order", order);

View File

@ -5,7 +5,7 @@ export default Discourse.Route.extend({
order: {
refreshModel: true
},
ascending: {
descending: {
refreshModel: true
}
},
@ -15,7 +15,7 @@ export default Discourse.Route.extend({
method: "get",
data: {
order: params.order,
ascending: params.ascending
descending: params.descending
}
}).then(results => results);
}