diff --git a/assets/javascripts/discourse/discourse-subscriptions-user-route-map.js.es6 b/assets/javascripts/discourse/discourse-subscriptions-user-route-map.js.es6 index f94ffbb..34eb963 100644 --- a/assets/javascripts/discourse/discourse-subscriptions-user-route-map.js.es6 +++ b/assets/javascripts/discourse/discourse-subscriptions-user-route-map.js.es6 @@ -2,7 +2,9 @@ export default { resource: "user", path: "users/:username", map() { - this.route("billing"); - this.route("subscriptions"); + this.route("billing", function() { + this.route("payments"); + this.route("subscriptions"); + }); } }; diff --git a/assets/javascripts/discourse/routes/user-activity-payments.js.es6 b/assets/javascripts/discourse/routes/user-activity-payments.js.es6 deleted file mode 100644 index 928619c..0000000 --- a/assets/javascripts/discourse/routes/user-activity-payments.js.es6 +++ /dev/null @@ -1,7 +0,0 @@ -import Route from "@ember/routing/route"; - -export default Route.extend({ - model() { - console.log(999); - } -}); diff --git a/assets/javascripts/discourse/routes/user-billing-index.js.es6 b/assets/javascripts/discourse/routes/user-billing-index.js.es6 new file mode 100644 index 0000000..f424751 --- /dev/null +++ b/assets/javascripts/discourse/routes/user-billing-index.js.es6 @@ -0,0 +1,9 @@ +import Route from "@ember/routing/route"; + +export default Route.extend({ + templateName: "user/billing/index", + + redirect() { + this.transitionTo("user.billing.subscriptions"); + } +}); diff --git a/assets/javascripts/discourse/routes/user-billing-payments.js.es6 b/assets/javascripts/discourse/routes/user-billing-payments.js.es6 new file mode 100644 index 0000000..38cc6c3 --- /dev/null +++ b/assets/javascripts/discourse/routes/user-billing-payments.js.es6 @@ -0,0 +1,10 @@ +import Route from "@ember/routing/route"; +import Invoice from "discourse/plugins/discourse-subscriptions/discourse/models/invoice"; + +export default Route.extend({ + templateName: "user/billing/payments", + + model() { + return Invoice.findAll(); + } +}); diff --git a/assets/javascripts/discourse/routes/user-subscriptions.js.es6 b/assets/javascripts/discourse/routes/user-billing-subscriptions.js.es6 similarity index 82% rename from assets/javascripts/discourse/routes/user-subscriptions.js.es6 rename to assets/javascripts/discourse/routes/user-billing-subscriptions.js.es6 index a667cf8..3527115 100644 --- a/assets/javascripts/discourse/routes/user-subscriptions.js.es6 +++ b/assets/javascripts/discourse/routes/user-billing-subscriptions.js.es6 @@ -2,18 +2,12 @@ import Route from "@ember/routing/route"; import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription"; export default Route.extend({ + templateName: "user/billing/subscriptions", + model() { return UserSubscription.findAll(); }, - setupController(controller, model) { - if (this.currentUser.id !== this.modelFor("user").id) { - this.replaceWith("userActivity"); - } else { - controller.setProperties({ model }); - } - }, - actions: { cancelSubscription(subscription) { bootbox.confirm( diff --git a/assets/javascripts/discourse/routes/user-billing.js.es6 b/assets/javascripts/discourse/routes/user-billing.js.es6 index 569ecf8..59f9f9d 100644 --- a/assets/javascripts/discourse/routes/user-billing.js.es6 +++ b/assets/javascripts/discourse/routes/user-billing.js.es6 @@ -1,10 +1,7 @@ import Route from "@ember/routing/route"; -import Invoice from "discourse/plugins/discourse-subscriptions/discourse/models/invoice"; export default Route.extend({ - model() { - return Invoice.findAll(); - }, + templateName: "user/billing", setupController(controller, model) { if (this.currentUser.id !== this.modelFor("user").id) { diff --git a/assets/javascripts/discourse/templates/connectors/user-main-nav/billing.hbs b/assets/javascripts/discourse/templates/connectors/user-main-nav/billing.hbs new file mode 100644 index 0000000..977d685 --- /dev/null +++ b/assets/javascripts/discourse/templates/connectors/user-main-nav/billing.hbs @@ -0,0 +1,3 @@ +{{#if (user-viewing-self model)}} + {{#link-to 'user.billing'}}{{d-icon "credit-card"}}{{I18n 'discourse_subscriptions.navigation.billing'}}{{/link-to}} +{{/if}} diff --git a/assets/javascripts/discourse/templates/connectors/user-main-nav/subscriptions.hbs b/assets/javascripts/discourse/templates/connectors/user-main-nav/subscriptions.hbs deleted file mode 100644 index 3efebfb..0000000 --- a/assets/javascripts/discourse/templates/connectors/user-main-nav/subscriptions.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{{#if (user-viewing-self model)}} - {{#link-to 'user.subscriptions'}}{{d-icon "credit-card"}}{{I18n 'discourse_subscriptions.navigation.subscriptions'}}{{/link-to}} -{{/if}} diff --git a/assets/javascripts/discourse/templates/user/billing.hbs b/assets/javascripts/discourse/templates/user/billing.hbs index fc690e5..caeee34 100644 --- a/assets/javascripts/discourse/templates/user/billing.hbs +++ b/assets/javascripts/discourse/templates/user/billing.hbs @@ -1,27 +1,22 @@ +{{#d-section pageClass="user-billing" class="user-secondary-navigation" scrollTop="false"}} + {{#mobile-nav + class='activity-nav' + desktopClass='action-list nav-stacked' + currentPath=router._router.currentPath + }} +
{{i18n 'discourse_subscriptions.user.billing.invoices.amount'}} | -{{i18n 'discourse_subscriptions.user.billing.invoices.number'}} | -{{i18n 'discourse_subscriptions.user.billing.invoices.created_at'}} | -- - {{#each model as |invoice|}} - |
---|---|---|---|
{{invoice.amount_paid}} | -{{invoice.number}} | -{{format-unix-date invoice.created}} | -- - {{d-icon "download"}} - - | -
{{i18n 'discourse_subscriptions.user.billing_help'}}
-{{/if}} +{{i18n 'discourse_subscriptions.user.billing_help'}}
+{{i18n 'discourse_subscriptions.user.subscriptions_help'}}
+