Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom steps template #83

Closed
kjrhody opened this issue Aug 19, 2020 · 0 comments
Closed

Implement custom steps template #83

kjrhody opened this issue Aug 19, 2020 · 0 comments

Comments

@kjrhody
Copy link

kjrhody commented Aug 19, 2020

I am trying to implement a custom steps template based on the discussion in another issue thread here (#62 (comment)). The reason for this is we have some steps that should only be accessible if certain conditions are met, and we do not want them to appear in the overall list (unless those conditions are met). I am using the following code, but the custom template does not appear to be generated. I cannot find any information in the documentation about how to do this. Can someone help?

Wizard setup & steps template:

<template name="survey">
{{> wizard id=graphic.identifier steps=steps stepsTemplate="steps_bootstrap3" route="basicMetadata" routeParams=routeParams projectId=project.identifier chapter=chapter graphic=graphic persist=true}}
</template>

<template name="steps_bootstrap3">
	<ul class="nav nav-wizard">
		{{#each wizard.steps}}
		<li class="{{stepClass id}}">
			{{#if pathForStep id}}
				<a href="{{pathForStep id}}">{{title}}</a>
			{{else}}
				{{title}}
			{{/if}}
		</li>
		{{/each}}
	</ul>
</template>

JS:

Template.steps_bootstrap3.events({
    'click a': function(e, tpl) {
        if (!this.wizard.route) {
            e.preventDefault();
            this.wizard.show(this.id);
        }
    }
});

Template.steps_bootstrap3.helpers({
    stepClass: function(id) {
        console.log("stepClass is initiated");
        var activeStep = this.wizard.activeStep();
        return (activeStep && activeStep.id == id) && 'active' || '';
    }
});
@kjrhody kjrhody closed this as completed Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant