Skip to content

Commit

Permalink
Make data from related_to_step_nav property to be accessisible
Browse files Browse the repository at this point in the history
This is required because when a content item has step by step disabled
it does not have the step_navs property but has the
step by steps within related_to_step_navs.

This is needed for the personalisation work that will be done to show step
by steps on pages where we know the user is actively interacting with a
specific step by step.
  • Loading branch information
Dilwoar Hussain committed Sep 25, 2018
1 parent 35f1039 commit 90cf839
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ def step_navs
end
end

def related_to_step_navs
@related_to_step_navs ||= parsed_related_to_step_navs.map do |step_nav|
StepByStepModel.new(step_nav)
end
end

def show_sidebar?
show_header? && current_step_nav.steps.present?
end
Expand Down Expand Up @@ -92,6 +98,10 @@ def parsed_step_navs
content_item.dig("links", "part_of_step_navs").to_a
end

def parsed_related_to_step_navs
content_item.dig("links", "related_to_step_navs").to_a
end

def configure_for_sidebar(step_nav_content)
step_nav_content[:steps].each_with_index do |step, step_index|
step[:contents].each do |content|
Expand Down

0 comments on commit 90cf839

Please sign in to comment.