Sha256: 24d7f48c3c5d150680f7d3e00aac8f2148d8a41aa59fae11b9f3e962094ce615

Contents?: true

Size: 962 Bytes

Versions: 5

Compression:

Stored size: 962 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 = {})
      aria = {}
      cls = %w(tabs-title)
      if is_active_link?(link, (options[:aria_link_type] || :inclusive))
        cls << "is-active"
        aria[:current] = "page"
      end

      content_tag(:li, class: cls.join(" "), aria: 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.27.10 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.27.9 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.27.8 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.27.7 app/helpers/decidim/user_profile_helper.rb
decidim-core-0.27.6 app/helpers/decidim/user_profile_helper.rb