From 20f605b89957bab7d6944687e79184c0ebd8fde4 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 19 Jun 2019 13:39:39 +0800 Subject: [PATCH] Use wizard name in no access messages --- .../javascripts/wizard/components/wizard-no-access.js.es6 | 2 +- assets/javascripts/wizard/routes/custom-index.js.es6 | 2 ++ assets/javascripts/wizard/templates/custom.index.hbs | 6 +++--- config/locales/client.en.yml | 6 +++--- lib/wizard_edits.rb | 6 +++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/assets/javascripts/wizard/components/wizard-no-access.js.es6 b/assets/javascripts/wizard/components/wizard-no-access.js.es6 index 83fcc7da..0b222ec1 100644 --- a/assets/javascripts/wizard/components/wizard-no-access.js.es6 +++ b/assets/javascripts/wizard/components/wizard-no-access.js.es6 @@ -10,4 +10,4 @@ export default Ember.Component.extend({ CustomWizard.skip(this.get('wizardId')); } } -}) +}); diff --git a/assets/javascripts/wizard/routes/custom-index.js.es6 b/assets/javascripts/wizard/routes/custom-index.js.es6 index 5e90807d..c857753d 100644 --- a/assets/javascripts/wizard/routes/custom-index.js.es6 +++ b/assets/javascripts/wizard/routes/custom-index.js.es6 @@ -17,10 +17,12 @@ export default Ember.Route.extend({ const minTrust = model.get('min_trust'); const wizardId = model.get('id'); const user = model.get('user'); + const name = model.get('name'); controller.setProperties({ requiresLogin: !user, user, + name, completed, notPermitted: !permitted, minTrust, diff --git a/assets/javascripts/wizard/templates/custom.index.hbs b/assets/javascripts/wizard/templates/custom.index.hbs index 7bcf6f2f..f6ac1df5 100644 --- a/assets/javascripts/wizard/templates/custom.index.hbs +++ b/assets/javascripts/wizard/templates/custom.index.hbs @@ -2,13 +2,13 @@ {{wizard-no-access text=(i18n 'wizard.none') wizardId=wizardId}} {{else}} {{#if requiresLogin}} - {{wizard-no-access text=(i18n 'wizard.requires_login' level=minTrust) wizardId=wizardId}} + {{wizard-no-access text=(i18n 'wizard.requires_login' name=name) wizardId=wizardId}} {{else}} {{#if notPermitted}} - {{wizard-no-access text=(i18n 'wizard.not_permitted' level=minTrust) wizardId=wizardId}} + {{wizard-no-access text=(i18n 'wizard.not_permitted' name=name level=minTrust) wizardId=wizardId}} {{else}} {{#if completed}} - {{wizard-no-access text=(i18n 'wizard.completed') wizardId=wizardId}} + {{wizard-no-access text=(i18n 'wizard.completed' name=name) wizardId=wizardId}} {{/if}} {{/if}} {{/if}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 2897ffa9..84e5bd06 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -177,11 +177,11 @@ en: filter_placeholder: "Search..." wizard: - completed: "You have completed this wizard." - not_permitted: "You need to be trust level {{level}} or higher to access this wizard." + completed: "You have completed the {{name}} wizard." + not_permitted: "You need to be trust level {{level}} or higher to access the {{name}} wizard." none: "There is no wizard here." return_to_site: "Return to {{siteName}}" - requires_login: "You need to be logged in to access this wizard." + requires_login: "You need to be logged in to access the {{name}} wizard." wizard_composer: show_preview: "Preview Post" diff --git a/lib/wizard_edits.rb b/lib/wizard_edits.rb index c93ac214..ad4f8ef7 100644 --- a/lib/wizard_edits.rb +++ b/lib/wizard_edits.rb @@ -64,7 +64,7 @@ class ::Wizard::Step end ::WizardSerializer.class_eval do - attributes :id, :background, :completed, :required, :min_trust, :permitted, :user + attributes :id, :name, :background, :completed, :required, :min_trust, :permitted, :user def id object.id @@ -74,6 +74,10 @@ end object.respond_to?(:id) end + def name + object.name + end + def background object.background end