Sha256: 08149439e17f2498f3c648364aaf8761dfb9ce3a4ba7b2ae71c9b7b836d7391b
Contents?: true
Size: 881 Bytes
Versions: 122
Compression:
Stored size: 881 Bytes
Contents
# frozen_string_literal: true module Decidim # Module to add the attribute `aria-selected` to links when they are # pointing to the current path. Uses the `active_link_to` gem to calculate # this. # module AriaSelectedLinkToHelper # Adds the `aria-selected` attribute to a link when it's pointing to the # current path. The API is the same than the `link_to` one, and uses this # helper internally. # # text - a String with the link text # link - Where the link should point to. Accepts the same value than # `link_to` helper. # options - An options Hash that will be passed to `link_to`. def aria_selected_link_to(text, link, options = {}) link_to( text, link, options.merge( "aria-selected": is_active_link?(link, options[:aria_link_type] || :inclusive) ) ) end end end
Version data entries
122 entries across 122 versions & 2 rubygems