human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Extract sidebar markup into helper

Open Benabik opened this issue 1 year ago • 1 comments

Description

The markup for the sidebar was copy/pasted many many times. This PR adds the following helpers:

  • sidebar - simply adds the appropriate ul wrapper for the sidebar to its block, which should have the other two helpers.
  • sidebar_item - Ensures that whenever the current page is the linked path, the item is active. Has an optional argument to be active for any path on the controller.
  • sidebar_group - Takes a list of items and ensures the group is open whenever any item under it is active. Can also take a controller similar to the item, useful if the sub-items are only some actions on a controller.

Notably, this fixes:

  • Several instances where the path checked was not the path linked
  • Several places where an item would be active in a group that wasn't
  • The active checks in the admin sidebar all missing the admin/ prefix

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Manually clicking on all the sidebar links and verifying they go to the correct place and highlight afterwards

Benabik avatar Jul 30 '23 16:07 Benabik

I'd like to hold off on this refactor until after / separate from the dashboard update.

awwaiid avatar Nov 12 '23 04:11 awwaiid

This has been sitting for a long time. Dashboard has been merged now. I'm going to close this for now - I'm fine with reopening if there's desire to.

dorner avatar Jun 09 '24 14:06 dorner