basic user billing page
This commit is contained in:
parent
9e981c3dae
commit
edd6449105
|
@ -0,0 +1,7 @@
|
||||||
|
export default {
|
||||||
|
resource: 'user',
|
||||||
|
path: 'users/:username',
|
||||||
|
map() {
|
||||||
|
this.route('billing');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
|
export default registerUnbound('user-viewing-self', function(model) {
|
||||||
|
if (Discourse.User.current()){
|
||||||
|
return Discourse.User.current().username.toLowerCase() === model.username.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
export default Discourse.Route.extend({
|
||||||
|
model() {
|
||||||
|
console.log('billing');
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController(controller, model) {
|
||||||
|
if (this.currentUser.id !== this.modelFor("user").id) {
|
||||||
|
this.replaceWith("userActivity");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
controller.setProperties({ model });
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
{{#if (user-viewing-self model)}}
|
||||||
|
{{#link-to 'user.billing'}}{{d-icon "credit-card"}}{{I18n 'discourse_patrons.navigation.billing'}}{{/link-to}}
|
||||||
|
{{/if}}
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
user/billing
|
|
@ -12,6 +12,7 @@ gem 'stripe', '5.7.1'
|
||||||
|
|
||||||
register_asset "stylesheets/common/discourse-patrons.scss"
|
register_asset "stylesheets/common/discourse-patrons.scss"
|
||||||
register_asset "stylesheets/mobile/discourse-patrons.scss"
|
register_asset "stylesheets/mobile/discourse-patrons.scss"
|
||||||
|
register_svg_icon "credit-card" if respond_to?(:register_svg_icon)
|
||||||
|
|
||||||
register_html_builder('server:before-head-close') do
|
register_html_builder('server:before-head-close') do
|
||||||
"<script src='https://js.stripe.com/v3/'></script>"
|
"<script src='https://js.stripe.com/v3/'></script>"
|
||||||
|
@ -33,6 +34,7 @@ Discourse::Application.routes.append do
|
||||||
get '/admin/plugins/discourse-patrons/subscriptions' => 'admin/plugins#index'
|
get '/admin/plugins/discourse-patrons/subscriptions' => 'admin/plugins#index'
|
||||||
get '/admin/plugins/discourse-patrons/plans' => 'admin/plugins#index'
|
get '/admin/plugins/discourse-patrons/plans' => 'admin/plugins#index'
|
||||||
get '/admin/plugins/discourse-patrons/plans/:plan_id' => 'admin/plugins#index'
|
get '/admin/plugins/discourse-patrons/plans/:plan_id' => 'admin/plugins#index'
|
||||||
|
get 'u/:username/billing' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||||
end
|
end
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
|
|
Loading…
Reference in New Issue