|
47 | 47 | %sup Beta |
48 | 48 |
|
49 | 49 | - if admin_nav? |
50 | | - = render partial: "layouts/nav/admin_nav" |
51 | | -
|
52 | | - = render partial: "layouts/nav/notifications_list" |
53 | | -
|
54 | | - = render partial: "layouts/nav/user_dropdown" |
| 50 | + %li.nav-item.dropdown{class: nav_item_class(:admin)} |
| 51 | + %a.nav-link.dropdown-toggle{title: 'Admin Toggle', href: '#', role: 'button', data: {bs_toggle: 'dropdown'}, aria: {expanded: 'false'}} |
| 52 | + Admin |
| 53 | + %ul.dropdown-menu.dropdown-menu-end |
| 54 | + %li |
| 55 | + = link_to admin_users_path, class: "dropdown-item #{'active' if request.path == admin_users_path}" do |
| 56 | + %i.bi.bi-people-fill |
| 57 | + %span Users |
| 58 | + %li |
| 59 | + = link_to admin_events_path, class: "dropdown-item #{'active' if request.path == admin_events_path}" do |
| 60 | + %i.bi.bi-calendar |
| 61 | + %span Events |
| 62 | + |
| 63 | + %li.nav-item.dropdown{class: nav_item_class(:notifications)} |
| 64 | + - unread_notifications = current_user.notifications.recent_unread.records |
| 65 | + %a.nav-link.dropdown-toggle{title: 'Notifications Toggle', href: '#', role: 'button', data: {bs_toggle: 'dropdown'}, aria: {expanded: 'false'}} |
| 66 | + %i.bi.bi-envelope-fill |
| 67 | + %span.badge.bg-secondary= unread_notifications.length if unread_notifications.any? |
| 68 | + |
| 69 | + %ul.dropdown-menu.dropdown-menu-end |
| 70 | + - if unread_notifications.any? |
| 71 | + - unread_notifications.each do |notification| |
| 72 | + %li |
| 73 | + = link_to notification_path(notification), class: 'dropdown-item' do |
| 74 | + %i.bi.bi-exclamation |
| 75 | + %span= notification.short_message |
| 76 | + %li |
| 77 | + %hr.dropdown-divider |
| 78 | + %li |
| 79 | + = link_to mark_all_as_read_notifications_path, data: {turbo: true, turbo_method: :post}, class: 'dropdown-item text-primary' do |
| 80 | + %i.bi.bi-check |
| 81 | + Mark all as read |
| 82 | + %li |
| 83 | + = link_to notifications_path, class: 'dropdown-item' do |
| 84 | + %i.bi.bi-eye |
| 85 | + %span |
| 86 | + = (more_unread_count = current_user.notifications.more_unread_count) > 0 ? "#{more_unread_count} More Unread" : "View all notifications" |
| 87 | + |
| 88 | + %li.nav-item.dropdown{class: nav_item_class(:user)} |
| 89 | + %a.nav-link.dropdown-toggle.gravatar-container{href: '#', role: 'button', data: {bs_toggle: 'dropdown'}, aria: {expanded: 'false'}} |
| 90 | + = image_tag("https://www.gravatar.com/avatar/#{current_user.gravatar_hash}?s=25", class: 'user-dropdown-gravatar', alt: '') |
| 91 | + #{current_user.name} |
| 92 | + %ul.dropdown-menu.dropdown-menu-end |
| 93 | + %li |
| 94 | + = link_to edit_profile_path, class: 'dropdown-item' do |
| 95 | + %i.bi.bi-person-fill |
| 96 | + %span My Profile |
| 97 | + - if current_user.teammates.loaded? ? current_user.teammates.any? : current_user.teammates.exists? |
| 98 | + %li |
| 99 | + = link_to notifications_profile_path, class: 'dropdown-item' do |
| 100 | + %i.bi.bi-bell-fill |
| 101 | + %span Notifications |
| 102 | + %li |
| 103 | + = link_to destroy_user_session_path, data: {turbo: true, turbo_method: :delete}, class: 'dropdown-item' do |
| 104 | + %i.bi.bi-box-arrow-right |
| 105 | + %span Sign Out |
55 | 106 |
|
56 | 107 | - else |
57 | 108 | %ul.navbar-nav.ms-auto |
|
0 commit comments