Module: MenuBarHelper
- Defined in:
- app/helpers/menu_bar_helper.rb
Instance Method Summary collapse
- #any_menu_bar_links? ⇒ Boolean
- #li_tag(link) ⇒ Object
- #logout_menu_link ⇒ Object
- #menu_bar_links ⇒ Object
- #menu_bar_list_items ⇒ Object
- #menu_item(icon, name, url, css_class = nil, translation_params = {}, options = {}) ⇒ Object
- #menu_link_to_application(icon, app_name, minimal_permissions) ⇒ Object
- #menu_link_to_bibliotheca ⇒ Object
- #menu_link_to_classroom ⇒ Object
- #menu_link_to_faqs ⇒ Object
- #menu_link_to_profile ⇒ Object
- #menu_text_item(icon, text, url, css_class = nil, **options) ⇒ Object
Instance Method Details
#any_menu_bar_links? ⇒ Boolean
50 51 52 |
# File 'app/helpers/menu_bar_helper.rb', line 50 def .any? end |
#li_tag(link) ⇒ Object
15 16 17 |
# File 'app/helpers/menu_bar_helper.rb', line 15 def li_tag(link) content_tag :li, link end |
#logout_menu_link ⇒ Object
37 38 39 |
# File 'app/helpers/menu_bar_helper.rb', line 37 def li_tag ('sign-out-alt', :sign_out, logout_path(origin: url_for, organization: Organization.current)) end |
#menu_bar_links ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/helpers/menu_bar_helper.rb', line 2 def [ , , solve_discussions_link, user_discussions_link ] end |
#menu_bar_list_items ⇒ Object
11 12 13 |
# File 'app/helpers/menu_bar_helper.rb', line 11 def .compact.map { |link| li_tag(link) }.join.html_safe end |
#menu_item(icon, name, url, css_class = nil, translation_params = {}, options = {}) ⇒ Object
41 42 43 |
# File 'app/helpers/menu_bar_helper.rb', line 41 def (icon, name, url, css_class = nil, translation_params = {}, = {}) (icon, t(name, translation_params), url, css_class, **) end |
#menu_link_to_application(icon, app_name, minimal_permissions) ⇒ Object
31 32 33 34 35 |
# File 'app/helpers/menu_bar_helper.rb', line 31 def (icon, app_name, ) return unless current_user&.send() url = url_for_application(app_name) icon, app_name, url end |
#menu_link_to_bibliotheca ⇒ Object
27 28 29 |
# File 'app/helpers/menu_bar_helper.rb', line 27 def :book, :bibliotheca_ui, :writer? end |
#menu_link_to_classroom ⇒ Object
23 24 25 |
# File 'app/helpers/menu_bar_helper.rb', line 23 def 'graduation-cap', :classroom_ui, :teacher_here? end |
#menu_link_to_faqs ⇒ Object
54 55 56 |
# File 'app/helpers/menu_bar_helper.rb', line 54 def li_tag (:info, :faqs_abbreviated, faqs_path) end |
#menu_link_to_profile ⇒ Object
19 20 21 |
# File 'app/helpers/menu_bar_helper.rb', line 19 def li_tag ('user', :my_account, user_path) end |
#menu_text_item(icon, text, url, css_class = nil, **options) ⇒ Object
45 46 47 48 |
# File 'app/helpers/menu_bar_helper.rb', line 45 def (icon, text, url, css_class = nil, **) = { role: 'menuitem', tabindex: '-1', class: "dropdown-item #{css_class}" }.merge() link_to fixed_fa_icon(icon, text: text), url, end |