Sha256: 5b4e25657bb7967309187666d9f73fd2de910a41eaebc4408485a04e55fbc887

Contents?: true

Size: 1.23 KB

Versions: 16

Compression:

Stored size: 1.23 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

  def exam_authorizations_user_menu_link
    user_menu_item t(:exams), exam_authorizations_user_path, 'exam_authorizations'
  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

16 entries across 16 versions & 1 rubygems

Version Path
mumuki-laboratory-9.10.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.9.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.8.2 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.8.1 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.8.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.7.2 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.7.1 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.7.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.6.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.5.1 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.5.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.4.1 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.4.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.3.1 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.3.0 app/helpers/user_menu_helper.rb
mumuki-laboratory-9.2.0 app/helpers/user_menu_helper.rb