diff --git a/assets/javascripts/discourse/routes/admin-wizards.js.es6 b/assets/javascripts/discourse/routes/admin-wizards.js.es6 index da184d93..4e4e3c40 100644 --- a/assets/javascripts/discourse/routes/admin-wizards.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards.js.es6 @@ -9,6 +9,7 @@ export default DiscourseRoute.extend({ setupController(controller, model) { controller.set('notices', A(model.notices)); + controller.set('api_section', model.api_section); }, afterModel(model, transition) { diff --git a/assets/javascripts/discourse/templates/admin-wizards.hbs b/assets/javascripts/discourse/templates/admin-wizards.hbs index b72f5a7b..aa3b2cf5 100644 --- a/assets/javascripts/discourse/templates/admin-wizards.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards.hbs @@ -2,7 +2,7 @@ {{nav-item route="adminWizardsWizard" label="admin.wizard.nav_label"}} {{nav-item route="adminWizardsCustomFields" label="admin.wizard.custom_field.nav_label"}} {{nav-item route="adminWizardsSubmissions" label="admin.wizard.submissions.nav_label"}} - {{#if api_subscription}} + {{#if api_section}} {{nav-item route="adminWizardsApi" label="admin.wizard.api.nav_label"}} {{/if}} {{nav-item route="adminWizardsLogs" label="admin.wizard.log.nav_label"}} diff --git a/controllers/custom_wizard/admin/admin.rb b/controllers/custom_wizard/admin/admin.rb index df11d25c..8a3b69ac 100644 --- a/controllers/custom_wizard/admin/admin.rb +++ b/controllers/custom_wizard/admin/admin.rb @@ -5,7 +5,7 @@ class CustomWizard::AdminController < ::Admin::AdminController def index render_json_dump( #TODO replace with appropriate static? - api_subscription: ["business"].includes?(CustomWizard::Subscription.type), + api_section: ["business"].include?(CustomWizard::Subscription.type), notices: ActiveModel::ArraySerializer.new( CustomWizard::Notice.list, each_serializer: CustomWizard::NoticeSerializer diff --git a/lib/custom_wizard/subscription.rb b/lib/custom_wizard/subscription.rb index 11e6d4d3..6c535602 100644 --- a/lib/custom_wizard/subscription.rb +++ b/lib/custom_wizard/subscription.rb @@ -27,6 +27,10 @@ class CustomWizard::Subscription "stripe" end + def type + @subscription.type + end + def client_name "custom-wizard" end @@ -119,6 +123,10 @@ class CustomWizard::Subscription self.new.subscribed? end + def self.type + self.new.type + end + def self.authorized? self.new.authorized? end diff --git a/lib/custom_wizard/subscription/subscription.rb b/lib/custom_wizard/subscription/subscription.rb index 129f993a..b2ddf744 100644 --- a/lib/custom_wizard/subscription/subscription.rb +++ b/lib/custom_wizard/subscription/subscription.rb @@ -13,7 +13,7 @@ class CustomWizard::Subscription::Subscription end def types - %w(community business) + %w(core advanced business) end def active?