Sha256: cd847339a42bf3ece65a75c2f4530b87d46417d1fceaaf4128d704bbbb326b46

Contents?: true

Size: 957 Bytes

Versions: 5

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Helpers used in controllers implementing the `Decidim::UserProfile` concern.
  module UserProfileHelper
    # Public: Shows a menu tab with a section. It highlights automatically bye
    # detecting if the current path is a subset of the provided route.
    #
    # text - The text to show in the tab.
    # link - The path to link to.
    # options - Extra options.
    #           aria_link_type - :inclusive or :exact, depending on the type of
    #                            highlighting desired.
    #
    # Returns a String with the menu tab.
    def user_profile_tab(text, link, options = {})
      cls = %w(tabs-title)
      aria = {}
      if is_active_link?(link, (options[:aria_link_type] || :inclusive))
        cls << "is-active"
        aria[:current] = "page"
      end

      content_tag(:li, class: cls.join(" "), aria:) do
        link_to(text, link, options)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.28.5 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.28.4 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.28.3 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.28.2 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.28.1 app/helpers/decidim/user_profile_helper.rb