From f4f1569e0c88a2c8be4027c6f79b49af0307b8f4 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 20 Sep 2016 14:04:18 -0400 Subject: [PATCH] Move step text into progress bar --- .../wizard/components/wizard-step.js.es6 | 9 ++-- .../templates/components/wizard-step.hbs | 9 ++-- app/assets/stylesheets/wizard.scss | 52 +++++++++++++------ 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/app/assets/javascripts/wizard/components/wizard-step.js.es6 b/app/assets/javascripts/wizard/components/wizard-step.js.es6 index 5930ffe6a77..d49a69c5f8f 100644 --- a/app/assets/javascripts/wizard/components/wizard-step.js.es6 +++ b/app/assets/javascripts/wizard/components/wizard-step.js.es6 @@ -52,10 +52,13 @@ export default Ember.Component.extend({ } }, - @computed('step.displayIndex', 'wizard.totalSteps') + @computed('step.index', 'wizard.totalSteps') barStyle(displayIndex, totalSteps) { - const ratio = parseFloat(displayIndex) / parseFloat(totalSteps) * 100; - return Ember.String.htmlSafe(`width: ${ratio}%`); + let ratio = parseFloat(displayIndex) / parseFloat(totalSteps - 1); + if (ratio < 0) { ratio = 0; } + if (ratio > 1) { ratio = 1; } + + return Ember.String.htmlSafe(`width: ${ratio * 200}px`); }, autoFocus() { diff --git a/app/assets/javascripts/wizard/templates/components/wizard-step.hbs b/app/assets/javascripts/wizard/templates/components/wizard-step.hbs index ada0018f0b1..0395db92680 100644 --- a/app/assets/javascripts/wizard/templates/components/wizard-step.hbs +++ b/app/assets/javascripts/wizard/templates/components/wizard-step.hbs @@ -20,11 +20,12 @@