Module: Decidim::ActiveLinkToHelper
- Included in:
- OnboardingActionMessageCell, ProfileCell
- Defined in:
- app/helpers/decidim/active_link_to_helper.rb
Overview
Overrides ActiveLinkTo#is_active_link? to handle locale-prefixed URLs.
Decidim adds the locale as a URL path segment (e.g. ‘/en/processes`), so the URL passed to the helper and `request.original_fullpath` both carry a locale prefix. This module normalizes the URL argument to always carry the current locale prefix before delegating to the gem, so active-state detection works correctly regardless of whether the caller already included the locale in the URL or not.
When the locale is part of the Rails script name rather than the path (i.e. the application is mounted at a locale-prefixed mount point), no normalization is performed and the original gem behaviour is preserved.
Include this module after ActiveLinkTo so that this override takes precedence.
Instance Method Summary collapse
-
#is_active_link?(url, condition = nil) ⇒ Boolean
Overrides ActiveLinkTo#is_active_link? to normalise locale-prefixed URLs before comparison.
Instance Method Details
#is_active_link?(url, condition = nil) ⇒ Boolean
Overrides ActiveLinkTo#is_active_link? to normalise locale-prefixed URLs before comparison.
28 29 30 |
# File 'app/helpers/decidim/active_link_to_helper.rb', line 28 def is_active_link?(url, condition = nil) # rubocop:disable Naming/PredicatePrefix super(locale_prefixed_url(url), condition) end |