change engine mount point and base path in jsapp
This commit is contained in:
parent
382fd4ac41
commit
08cbff0c1c
|
@ -3,7 +3,7 @@ import { ajax } from "discourse/lib/ajax";
|
|||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
stripePaymentHandler(data) {
|
||||
return ajax("/patrons/patrons", {
|
||||
return ajax("/s/patrons", {
|
||||
data,
|
||||
method: "post"
|
||||
}).catch(() => {
|
|
@ -25,7 +25,7 @@ export default Ember.Controller.extend({
|
|||
source: result.token.id
|
||||
};
|
||||
|
||||
return ajax("/patrons/customers", {
|
||||
return ajax("/s/customers", {
|
||||
method: "post",
|
||||
data: customerData
|
||||
}).then(customer => {
|
|
@ -20,7 +20,7 @@ const AdminPlan = Plan.extend({
|
|||
},
|
||||
|
||||
destroy() {
|
||||
return ajax(`/patrons/admin/plans/${this.id}`, { method: "delete" });
|
||||
return ajax(`/s/admin/plans/${this.id}`, { method: "delete" });
|
||||
},
|
||||
|
||||
save() {
|
||||
|
@ -35,7 +35,7 @@ const AdminPlan = Plan.extend({
|
|||
active: this.active
|
||||
};
|
||||
|
||||
return ajax("/patrons/admin/plans", { method: "post", data });
|
||||
return ajax("/s/admin/plans", { method: "post", data });
|
||||
},
|
||||
|
||||
update() {
|
||||
|
@ -46,19 +46,19 @@ const AdminPlan = Plan.extend({
|
|||
active: this.active
|
||||
};
|
||||
|
||||
return ajax(`/patrons/admin/plans/${this.id}`, { method: "patch", data });
|
||||
return ajax(`/s/admin/plans/${this.id}`, { method: "patch", data });
|
||||
}
|
||||
});
|
||||
|
||||
AdminPlan.reopenClass({
|
||||
findAll(data) {
|
||||
return ajax("/patrons/admin/plans", { method: "get", data }).then(result =>
|
||||
return ajax("/s/admin/plans", { method: "get", data }).then(result =>
|
||||
result.map(plan => AdminPlan.create(plan))
|
||||
);
|
||||
},
|
||||
|
||||
find(id) {
|
||||
return ajax(`/patrons/admin/plans/${id}`, { method: "get" }).then(plan =>
|
||||
return ajax(`/s/admin/plans/${id}`, { method: "get" }).then(plan =>
|
||||
AdminPlan.create(plan)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ const AdminProduct = Discourse.Model.extend({
|
|||
metadata: {},
|
||||
|
||||
destroy() {
|
||||
return ajax(`/patrons/admin/products/${this.id}`, { method: "delete" });
|
||||
return ajax(`/s/admin/products/${this.id}`, { method: "delete" });
|
||||
},
|
||||
|
||||
save() {
|
||||
|
@ -16,7 +16,7 @@ const AdminProduct = Discourse.Model.extend({
|
|||
active: this.active
|
||||
};
|
||||
|
||||
return ajax("/patrons/admin/products", {
|
||||
return ajax("/s/admin/products", {
|
||||
method: "post",
|
||||
data
|
||||
}).then(product => AdminProduct.create(product));
|
||||
|
@ -30,7 +30,7 @@ const AdminProduct = Discourse.Model.extend({
|
|||
active: this.active
|
||||
};
|
||||
|
||||
return ajax(`/patrons/admin/products/${this.id}`, {
|
||||
return ajax(`/s/admin/products/${this.id}`, {
|
||||
method: "patch",
|
||||
data
|
||||
});
|
||||
|
@ -39,13 +39,13 @@ const AdminProduct = Discourse.Model.extend({
|
|||
|
||||
AdminProduct.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/admin/products", { method: "get" }).then(result =>
|
||||
return ajax("/s/admin/products", { method: "get" }).then(result =>
|
||||
result.map(product => AdminProduct.create(product))
|
||||
);
|
||||
},
|
||||
|
||||
find(id) {
|
||||
return ajax(`/patrons/admin/products/${id}`, {
|
||||
return ajax(`/s/admin/products/${id}`, {
|
||||
method: "get"
|
||||
}).then(product => AdminProduct.create(product));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ const AdminSubscription = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
destroy() {
|
||||
return ajax(`/patrons/admin/subscriptions/${this.id}`, {
|
||||
return ajax(`/s/admin/subscriptions/${this.id}`, {
|
||||
method: "delete"
|
||||
}).then(result => AdminSubscription.create(result));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ const AdminSubscription = Discourse.Model.extend({
|
|||
|
||||
AdminSubscription.reopenClass({
|
||||
find() {
|
||||
return ajax("/patrons/admin/subscriptions", {
|
||||
return ajax("/s/admin/subscriptions", {
|
||||
method: "get"
|
||||
}).then(result =>
|
||||
result.data.map(subscription => AdminSubscription.create(subscription))
|
||||
|
|
|
@ -4,7 +4,7 @@ const Invoice = Discourse.Model.extend({});
|
|||
|
||||
Invoice.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/invoices", { method: "get" }).then(result =>
|
||||
return ajax("/s/invoices", { method: "get" }).then(result =>
|
||||
result.map(invoice => Invoice.create(invoice))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ const Plan = Discourse.Model.extend({
|
|||
|
||||
Plan.reopenClass({
|
||||
findAll(data) {
|
||||
return ajax("/patrons/plans", { method: "get", data }).then(result =>
|
||||
return ajax("/s/plans", { method: "get", data }).then(result =>
|
||||
result.map(plan => Plan.create(plan))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@ const Product = Discourse.Model.extend({});
|
|||
|
||||
Product.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/products", { method: "get" }).then(result =>
|
||||
return ajax("/s/products", { method: "get" }).then(result =>
|
||||
result.map(product => Product.create(product))
|
||||
);
|
||||
},
|
||||
|
||||
find(id) {
|
||||
return ajax(`/patrons/products/${id}`, { method: "get" }).then(product =>
|
||||
return ajax(`/s/products/${id}`, { method: "get" }).then(product =>
|
||||
Product.create(product)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ const Subscription = Discourse.Model.extend({
|
|||
plan: this.plan
|
||||
};
|
||||
|
||||
return ajax("/patrons/subscriptions", { method: "post", data });
|
||||
return ajax("/s/subscriptions", { method: "post", data });
|
||||
}
|
||||
});
|
||||
|
||||
Subscription.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/subscriptions", { method: "get" }).then(result =>
|
||||
return ajax("/s/subscriptions", { method: "get" }).then(result =>
|
||||
result.map(subscription => Subscription.create(subscription))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ const UserSubscription = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
destroy() {
|
||||
return ajax(`/patrons/user/subscriptions/${this.id}`, {
|
||||
return ajax(`/s/user/subscriptions/${this.id}`, {
|
||||
method: "delete"
|
||||
}).then(result => UserSubscription.create(result));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ const UserSubscription = Discourse.Model.extend({
|
|||
|
||||
UserSubscription.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/user/subscriptions", { method: "get" }).then(result =>
|
||||
return ajax("/s/user/subscriptions", { method: "get" }).then(result =>
|
||||
result.map(subscription => {
|
||||
subscription.plan = Plan.create(subscription.plan);
|
||||
return UserSubscription.create(subscription);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export default function() {
|
||||
this.route("patrons", function() {
|
||||
this.route("s", function() {
|
||||
this.route("subscribe", function() {
|
||||
this.route("show", { path: "/:subscription-id" });
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ export default Discourse.Route.extend({
|
|||
phone: ""
|
||||
});
|
||||
|
||||
return ajax("/patrons", {
|
||||
return ajax("/s", {
|
||||
method: "get"
|
||||
})
|
||||
.then(result => {
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
{{#if currentUser}}
|
||||
<div class="pull-right">
|
||||
{{#link-to "patrons.subscribe.show" product.id disabled=product.subscribed class="btn btn-primary"}}
|
||||
{{#link-to "s.subscribe.show" product.id disabled=product.subscribed class="btn btn-primary"}}
|
||||
{{i18n 'discourse_patrons.subscribe.title'}}
|
||||
{{/link-to}}
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{#if (show-extra-nav)}}
|
||||
{{#link-to 'patrons.subscribe' class='discourse-patrons-subscribe'}}
|
||||
{{#link-to 's.subscribe' class='discourse-patrons-subscribe'}}
|
||||
{{i18n 'discourse_patrons.navigation.subscribe'}}
|
||||
{{/link-to}}
|
||||
{{/if}}
|
||||
|
|
|
@ -16,6 +16,7 @@ en:
|
|||
js:
|
||||
discourse_patrons:
|
||||
title: Discourse Subscriptions
|
||||
admin_navigation: Subscriptions
|
||||
optional: Optional
|
||||
transactions:
|
||||
payment:
|
||||
|
|
|
@ -24,7 +24,7 @@ extend_content_security_policy(
|
|||
script_src: ['https://js.stripe.com/v3/']
|
||||
)
|
||||
|
||||
add_admin_route 'discourse_patrons.title', 'discourse-subscriptions.products'
|
||||
add_admin_route 'discourse_patrons.admin_navigation', 'discourse-subscriptions.products'
|
||||
|
||||
Discourse::Application.routes.append do
|
||||
get '/admin/plugins/discourse-subscriptions' => 'admin/plugins#index'
|
||||
|
@ -69,6 +69,6 @@ after_initialize do
|
|||
].each { |path| require File.expand_path(path, __FILE__) }
|
||||
|
||||
Discourse::Application.routes.append do
|
||||
mount ::DiscoursePatrons::Engine, at: 'patrons'
|
||||
mount ::DiscoursePatrons::Engine, at: 's'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue