<% options = {} options[:heading_level] = heading_level ||= 2 steps ||= false small ||= false show_step ||= false remember_last_step ||= false step_nav_url ||= false highlight_step ||= false tracking_id ||= false step_nav_content_id ||= tracking_id step_count = 0 step_number = 0 step_nav_helper = GovukPublishingComponents::Presenters::StepByStepNavHelper.new %> <% if steps %>
<%= "data-id=#{tracking_id}" if tracking_id %> data-show-text="<%= t("govuk_component.step_by_step_nav.show", default: "show") %>" data-hide-text="<%= t("govuk_component.step_by_step_nav.hide", default: "hide") %>" data-show-all-text="<%= t("govuk_component.step_by_step_nav.show_all", default: "Show all") %>" data-hide-all-text="<%= t("govuk_component.step_by_step_nav.hide_all", default: "Hide all") %>" >
    <% steps.each_with_index do |step, step_index| %> <% step_is_active = step_index + 1 == highlight_step step_count += 1 id = step_nav_helper.generate_step_nav_id(step[:title]) logic = false logic = step[:logic] if ["and", "or"].include? step[:logic] circle_class = "gem-c-step-nav__circle--number" circle_class = "gem-c-step-nav__circle--logic" if logic %>
  1. " <% if step_is_active %>aria-current="step"<% end %> <%= "data-show" if step_count == show_step %> id="<%= id %>" data-track-count="stepNavSection" <%= "data-optional" if step[:optional] %> >
    "> <%= content_tag("h#{heading_level}", class: 'gem-c-step-nav__title') do %> <% if logic %> <%= logic %> <% else %> <% step_number += 1 %> Step <%= step_number %> <% end %> <%= step[:title] %> <% end %>
    <% in_substep = false options[:step_nav_content_id] = step_nav_content_id options[:step_index] = step_index options[:link_index] = 0 %> <% step[:contents].each do |element| %> <%= step_nav_helper.render_step_nav_element(element, options) %> <% if element[:type] == 'list' options[:link_index] += element[:contents].length end %> <% end %>
  2. <% end %>
<% end %>