remove subscribe index
This commit is contained in:
parent
57fb508514
commit
4b334a69b5
|
@ -1,24 +1 @@
|
||||||
import { ajax } from "discourse/lib/ajax";
|
export default Ember.Controller.extend({});
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
|
||||||
actions: {
|
|
||||||
stripePaymentHandler(data) {
|
|
||||||
return ajax("/s/patrons", {
|
|
||||||
data,
|
|
||||||
method: "post"
|
|
||||||
}).catch(() => {
|
|
||||||
return { error: "An error occured while submitting the form." };
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
paymentSuccessHandler(/* paymentIntentId */) {
|
|
||||||
bootbox.alert(
|
|
||||||
I18n.t("discourse_subscriptions.transactions.payment.success")
|
|
||||||
);
|
|
||||||
this.transitionToRoute(
|
|
||||||
"user.billing",
|
|
||||||
Discourse.User.current().username.toLowerCase()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
queryParams: {
|
queryParams: {
|
||||||
order: {
|
order: {
|
||||||
refreshModel: true
|
refreshModel: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return AdminPlan.findAll();
|
return AdminPlan.findAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
export default Discourse.Route.extend({});
|
import Route from "@ember/routing/route";
|
||||||
|
|
||||||
|
export default Route.extend({});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return AdminProduct.findAll();
|
return AdminProduct.findAll();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||||
import Group from "discourse/models/group";
|
import Group from "discourse/models/group";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const id = params["plan-id"];
|
const id = params["plan-id"];
|
||||||
const product = this.modelFor(
|
const product = this.modelFor(
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const product_id = params["product-id"];
|
const product_id = params["product-id"];
|
||||||
let product;
|
let product;
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
export default Discourse.Route.extend({});
|
import Route from "@ember/routing/route";
|
||||||
|
|
||||||
|
export default Route.extend({});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import AdminSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/admin-subscription";
|
import AdminSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/admin-subscription";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return AdminSubscription.find();
|
return AdminSubscription.find();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
export default Discourse.Route.extend({});
|
import Route from "@ember/routing/route";
|
||||||
|
|
||||||
|
export default Route.extend({});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return Product.findAll();
|
return Product.findAll();
|
||||||
}
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||||
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const product_id = params["subscription-id"];
|
const product_id = params["subscription-id"];
|
||||||
|
|
|
@ -1,22 +1,3 @@
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import Route from "@ember/routing/route";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend();
|
||||||
model() {
|
|
||||||
const user = Ember.Object.create({
|
|
||||||
name: "",
|
|
||||||
email: "",
|
|
||||||
phone: ""
|
|
||||||
});
|
|
||||||
|
|
||||||
return ajax("/s", {
|
|
||||||
method: "get"
|
|
||||||
})
|
|
||||||
.then(result => {
|
|
||||||
user.set("email", result.email);
|
|
||||||
return user;
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
return user;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import Invoice from "discourse/plugins/discourse-subscriptions/discourse/models/invoice";
|
import Invoice from "discourse/plugins/discourse-subscriptions/discourse/models/invoice";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return Invoice.findAll();
|
return Invoice.findAll();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import Route from "@ember/routing/route";
|
||||||
import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription";
|
import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return UserSubscription.findAll();
|
return UserSubscription.findAll();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
export default function() {
|
export default function() {
|
||||||
this.route("s", function() {
|
this.route("s", function() {
|
||||||
this.route("subscribe", function() {
|
this.route("show", { path: "/:subscription-id" });
|
||||||
this.route("show", { path: "/:subscription-id" });
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
{{#if currentUser}}
|
{{#if currentUser}}
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{{#link-to "s.subscribe.show" product.id disabled=product.subscribed class="btn btn-primary"}}
|
{{#link-to "s.show" product.id disabled=product.subscribed class="btn btn-primary"}}
|
||||||
{{i18n 'discourse_subscriptions.subscribe.title'}}
|
{{i18n 'discourse_subscriptions.subscribe.title'}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{#if (show-extra-nav)}}
|
{{#if (show-extra-nav)}}
|
||||||
{{#link-to 's.subscribe' class='discourse-patrons-subscribe'}}
|
{{#link-to 's' class='discourse-patrons-subscribe'}}
|
||||||
{{i18n 'discourse_subscriptions.navigation.subscribe'}}
|
{{i18n 'discourse_subscriptions.navigation.subscribe'}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,14 +1,4 @@
|
||||||
|
|
||||||
<h3>{{i18n 'discourse_subscriptions.one_time.heading.payment' site_name=siteSettings.title}}</h3>
|
<div id="product-list">
|
||||||
|
{{product-list products=model}}
|
||||||
<p>
|
|
||||||
{{cook-text siteSettings.discourse_subscriptions_payment_page}}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="donations-page-payment">
|
|
||||||
{{donation-form
|
|
||||||
billing=model
|
|
||||||
paymentSuccessHandler=(action "paymentSuccessHandler")
|
|
||||||
stripePaymentHandler=(action "stripePaymentHandler")
|
|
||||||
}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
<div id="product-list">
|
|
||||||
{{product-list products=model}}
|
|
||||||
</div>
|
|
|
@ -7,7 +7,12 @@ module DiscourseSubscriptions
|
||||||
context "not authenticated" do
|
context "not authenticated" do
|
||||||
it "does not create a payment intent" do
|
it "does not create a payment intent" do
|
||||||
::Stripe::PaymentIntent.expects(:create).never
|
::Stripe::PaymentIntent.expects(:create).never
|
||||||
post "/s/payments.json", params: { }
|
|
||||||
|
post "/s/payments.json", params: {
|
||||||
|
payment_method: 'pm_123',
|
||||||
|
amount: 999,
|
||||||
|
currency: 'gdp'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue