docbrown/app/helpers
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
..
admin_helper.rb Refactoring AdminMenu and Menu towards classes (#16847) 2022-03-21 13:31:20 -04:00
application_helper.rb add new color picker to user experience config (#16769) 2022-03-08 12:43:01 +00:00
articles_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00
authentication_helper.rb Remove Creator Onboarding Feature Flags from Codebase (#15982) 2022-01-31 11:30:43 -07:00
broadcasts_helper.rb Add ahoy + welcome notification tracking (#8758) [deploy] 2020-06-18 13:40:14 -07:00
comments_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00
crayons_helper.rb Update crayons_icon_tag helper (#16099) 2022-01-14 17:14:42 +07:00
date_helper.rb Add I18n date format example (#14973) 2021-10-08 15:08:56 -04:00
display_ad_helper.rb Rubocop fixes (#14868) 2021-09-30 13:22:09 -04:00
feedback_messages_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00
listing_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00
notifications_helper.rb ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
organization_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00
profile_helper.rb [Small Wins] Show character limits for profile inputs (#15255) 2021-11-05 09:11:42 -04:00
rate_limit_checker_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00
settings_helper.rb "Reply to" and "From" Email addresses for SMTP Configurations (#16499) 2022-02-16 16:14:54 +02:00
social_image_helper.rb Fix Ruby 2.7 kwargs' warnings & misc spec warnings (#13256) 2021-04-06 16:57:59 -04:00
social_link_helper.rb app/helpers i18n (#16003) 2022-01-13 11:46:32 -05:00