Skip to content

Commit

Permalink
Merge pull request #538 from alphagov/fix-accordion-functionality-on-…
Browse files Browse the repository at this point in the history
…learning-to-drive-in-sidebar-navigation

Fix "open step" on TaskList Sidebar
  • Loading branch information
deborahchua authored Nov 15, 2017
2 parents 736b79f + 8874f9d commit 0a65ef2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ def configure_current_task(config)

def set_task_as_active_if_current_page(tasklist)
counter = 0
tasklist[:steps].each do |grouped_steps|
tasklist[:groups].each do |grouped_steps|
grouped_steps.each do |step|
counter = counter + 1

step[:panel_links].each do |link|
if link[:href] == request.path
link[:active] = true
tasklist[:open_section] = counter
tasklist[:open_step] = counter
return tasklist
end
end
Expand Down
2 changes: 1 addition & 1 deletion config/tasklists/learn-to-drive-a-car.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"tasklist": {
"small": true,
"heading_level": 3,
"steps": [
"groups": [
[
{
"title": "Check you're allowed to drive",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tasklist_content_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TasklistContentTest < ActiveSupport::TestCase
end

test "have a link in the correct structure" do
first_link = @config[:tasklist][:steps][0][0][:panel_links][0]
first_link = @config[:tasklist][:groups][0][0][:panel_links][0]
assert_equal "/vehicles-can-drive", first_link[:href]
assert_equal "Check what age you can drive", first_link[:text]
end
Expand Down

0 comments on commit 0a65ef2

Please sign in to comment.