Sha256: 35558238af72f5b110be2b88b301c5b15c29ecdae572b32e10e7f34b439d3730

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

module UserMenuHelper
  def user_menu_header
    content_tag :div, user_menu_header_icon, class: 'mu-user-menu-header'
  end

  def user_menu_divider
    content_tag :div, '', class: 'mu-user-menu-divider horizontal'
  end

  def profile_user_menu_link
    user_menu_item t(:my_profile), user_path, 'show'
  end

  def messages_user_menu_link
    user_menu_item t(:messages), messages_user_path, 'messages'
  end

  def discussions_user_menu_link
    user_menu_item t(:discussions), discussions_user_path, 'discussions' if current_user&.can_discuss_here?
  end

  def activity_user_menu_link
    user_menu_item t(:activity), activity_user_path, 'activity'
  end

  def certificates_user_menu_link
    user_menu_item t(:certificates), certificates_user_path, 'certificates'
  end

  private

  def user_menu_item(label, path, active_on)
    link_klass = 'active' if action_name == active_on
    content_tag :div, link_to(label, path, { class: link_klass }.compact), class: 'mu-user-menu-item'
  end

  def user_menu_header_icon
    fa_icon('chevron-down', text: t(:my_account), id: 'mu-user-menu-header-icon', right: true)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mumuki-laboratory-9.1.3 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.1.2 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.1.1 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.1.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.0.6 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.0.5 app/helpers/user_menu_helper.rb