We were getting a few errors when trying out Zeitwerk: ``` expected file lib/sms_api.rb to define constant SmsApi expected file app/components/layout/common_html_attributes_component.rb to define constant Layout::CommonHtmlAttributesComponent ``` In these cases, we aren't using an inflection because we also define the `Verification::SmsController` and a few migrations containing `Html` in their class name, and none of them would work if we defined the inflection. We were also getting an error regarding classes containing WYSIWYG in its name: ``` NameError: uninitialized constant WYSIWYGSanitizer Did you mean? WysiwygSanitizer ``` In this case, adding the acronym is easier, since we never use "Wysiwyg" in the code but we use "WYSIWYG" in many places.
17 lines
456 B
Ruby
17 lines
456 B
Ruby
module LayoutsHelper
|
|
def layout_menu_link_to(text, path, is_active, options)
|
|
title = t("shared.go_to_page") + text
|
|
|
|
if is_active
|
|
tag.span(t("shared.you_are_in"), class: "show-for-sr") + " " +
|
|
link_to(text, path, options.merge(class: "is-active", title: title))
|
|
else
|
|
link_to(text, path, options.merge(title: title))
|
|
end
|
|
end
|
|
|
|
def common_html_attributes
|
|
render Layout::CommonHtmlAttributesComponent.new
|
|
end
|
|
end
|