Module: Decidim::UserProfileHelper

Included in:
ProfileCell
Defined in:
app/helpers/decidim/user_profile_helper.rb

Overview

Helpers used in controllers implementing the ‘Decidim::UserProfile` concern.

Instance Method Summary collapse

Instance Method Details

#user_profile_tab(text, link, options = {}) ⇒ Object

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.



16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/decidim/user_profile_helper.rb', line 16

def (text, link, options = {})
  aria = {}
  if is_active_link?(link, (options[:aria_link_type] || :inclusive))
    cls << "is-active"
    aria[:current] = "page"
  end

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