docbrown/app/views/admin/shared
Jeremy Friesen 71e9f2bfb4
Refactoring AdminMenu and Menu towards classes (#16847)
As I was looking to implement the new Spaces feature (see
forem/forem#16842), I began looking at how to adjust the admin menu.  I
found the Menu and AdminMenu.  I wanted to add the "spaces" item under
the `:content_manager` scope.  Looking at the implementation, I saw I
would need some additional branching logic.

To get an understanding of the implementation, I chose factor towards
classes.

This refactor does a few things:

1) Clarifies a method name (e.g. "children?" becomes
   "has_multiple_children?")
2) Adds some tests of the menu implementation.
3) Removes deeply nested hashs in favor of first class objects.
4) Removes a complex method for determining menu visibility, instead
   favoring a method that either takes a boolean OR a lambda.

There are further refactors to consider, especially in regards to the
helper methods and some of the coercion of strings into different
formats.  But this refactor gets me the part I most am interested in:

Making it easier to specify a menu item as visible or not.
2022-03-21 13:31:20 -04:00
..
_card_header.html.erb Admin: Change label of toggle buttons in Configuration panel (#12183) 2021-01-11 16:38:16 +01:00
_destroy_confirmation_modal.html.erb Heavy Confirmation Flow for Broadcast-Destroy (#14819) 2021-09-29 07:43:00 -04:00
_image_uploader.html.erb Adjusts inline comment so that it does not appear in view (#13087) [deploy] 2021-03-22 15:25:14 -06:00
_logo_upload.html.erb Remove Creator Onboarding Feature Flags from Codebase (#15982) 2022-01-31 11:30:43 -07:00
_navbar.html.erb Fix double render of Overview in admin navbar (#12857) 2021-03-02 07:35:10 -06:00
_nested_sidebar.html.erb Refactoring AdminMenu and Menu towards classes (#16847) 2022-03-21 13:31:20 -04:00
_tabbed_navbar.html.erb Refactoring AdminMenu and Menu towards classes (#16847) 2022-03-21 13:31:20 -04:00