From 92fb880502e63c017c824db5590bed22b8bba4b6 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 19 Jun 2019 12:32:03 +0800 Subject: [PATCH] Cook step titles --- assets/javascripts/wizard/initializers/custom.js.es6 | 4 ++++ .../javascripts/wizard/templates/components/wizard-step.hbs | 2 +- lib/wizard_edits.rb | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/wizard/initializers/custom.js.es6 b/assets/javascripts/wizard/initializers/custom.js.es6 index c426514e..225f1f0f 100644 --- a/assets/javascripts/wizard/initializers/custom.js.es6 +++ b/assets/javascripts/wizard/initializers/custom.js.es6 @@ -71,6 +71,10 @@ export default { return index === 0 && !required; }.property('step.index', 'wizard.required'), + cookedTitle: function() { + return cook(this.get('step.title')); + }.property('step.title'), + cookedDescription: function() { return cook(this.get('step.description')); }.property('step.description'), diff --git a/assets/javascripts/wizard/templates/components/wizard-step.hbs b/assets/javascripts/wizard/templates/components/wizard-step.hbs index 41cc336a..ae793060 100644 --- a/assets/javascripts/wizard/templates/components/wizard-step.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-step.hbs @@ -1,6 +1,6 @@
{{#if step.title}} -

{{step.title}}

+

{{cookedTitle}}

{{/if}} {{#if step.description}} diff --git a/lib/wizard_edits.rb b/lib/wizard_edits.rb index 4a24afd3..9ca52331 100644 --- a/lib/wizard_edits.rb +++ b/lib/wizard_edits.rb @@ -127,8 +127,8 @@ end ::WizardStepSerializer.class_eval do def title - return object.title if object.title - I18n.t("#{object.key || i18n_key}.title", default: '') + return PrettyText.cook(object.title) if object.title + PrettyText.cook(I18n.t("#{object.key || i18n_key}.title", default: '')) end def description