flip ordering
This commit is contained in:
parent
18cf0e7f26
commit
910e08e4c9
|
@ -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
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue