docbrown/app/lib
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
..
acts_as_taggable_on Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606) 2021-05-03 11:09:45 -04:00
constants Remove Remaining logo_svg Code (#16291) 2022-02-22 12:05:16 -07:00
honeycomb [deploy] Optimization:Throttle Noisy Honeycomb Events More (#10143) 2020-09-01 15:21:07 -05:00
middlewares Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
redcarpet/render Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
reverse_markdown/converters Spelling fixes to live code (#15670) 2021-12-06 12:11:25 +02:00
api_constraints.rb [15 min fix] Fix some autoloading deprecation warnings (#13793) 2021-05-20 18:10:25 +02:00
app_secrets.rb [deploy] Feature: Setup Admin Area to Update Vault Secrets (#8935) 2020-06-29 15:08:09 -05:00
black_box.rb Move BlackBox to app/lib (#16183) 2022-01-20 09:37:53 +07:00
html_css_to_image.rb Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
menu.rb Refactoring AdminMenu and Menu towards classes (#16847) 2022-03-21 13:31:20 -04:00
rails_env_constraint.rb Easier feature flag handling for Cypress (#16379) 2022-02-03 10:42:13 -05:00
release_phase_notifier.rb [deploy] Refactor:Send a Couple More Errors to Honeybadger (#9223) 2020-07-09 10:53:16 -05:00
seeder.rb Cleaning Test Runs for End to End (E2E) Tests (#12143) 2021-01-29 13:34:01 +01:00
string_attribute_cleaner.rb Renaming method for clarity (#16791) 2022-03-07 12:55:56 -05:00
throttled_call.rb Spike: Add ThrottledCall utility class (#12779) 2021-03-01 08:51:04 +07:00
url.rb Test Solution for Forem-link Embed issues on Canary2 (#16843) 2022-03-09 18:26:02 -05:00