Put IDs directly on nav entries

This commit is contained in:
Karina Kwiatek 2023-08-16 21:17:18 +02:00
parent bcfb215f8c
commit cb89d42813
3 changed files with 7 additions and 8 deletions

View File

@ -8,6 +8,7 @@ module BootstrapHelper
badge_attr: {},
icon: nil,
class: "",
id: nil,
hotkey: nil,
}.merge(options)
@ -34,7 +35,7 @@ module BootstrapHelper
body += " #{content_tag(:span, options[:badge], class: badge_class, **options[:badge_attr])}".html_safe
end
content_tag(:li, link_to(body.html_safe, path, class: "nav-link", data: { hotkey: options[:hotkey] }), class: classes)
content_tag(:li, link_to(body.html_safe, path, class: "nav-link", data: { hotkey: options[:hotkey] }), class: classes, id: options[:id])
end
def list_group_item(body, path, options = {})

View File

@ -1,4 +1,4 @@
%nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top.d-lg-block.d-none.d-print-none{ class: Rails.env.development? ? "navbar-dev" : "", role: :navigation }
%nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top.d-lg-block.d-none.d-print-none{ class: Rails.env.tdevelopment? ? "navbar-dev" : "", role: :navigation }
.container
%a.navbar-brand{ href: '/', title: APP_CONFIG["site_name"] }
- if APP_CONFIG["use_svg_logo"]
@ -10,8 +10,7 @@
DEV
%ul.nav.navbar-nav.me-auto
= nav_entry t("navigation.timeline"), root_path, icon: "home", hotkey: "g t"
#nav-inbox-desktop
= nav_entry t("navigation.inbox"), "/inbox", icon: "inbox", badge: inbox_count, badge_attr: { data: { controller: "pwa-badge" } }, hotkey: "g i"
= nav_entry t("navigation.inbox"), "/inbox", icon: "inbox", badge: inbox_count, badge_attr: { data: { controller: "pwa-badge" } }, hotkey: "g i", id: "nav-inbox-desktop"
- if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod?
= nav_entry t("navigation.discover"), discover_path, icon: "compass", hotkey: "g d"
%ul.nav.navbar-nav

View File

@ -3,10 +3,9 @@
.container
%ul.nav.navbar-nav.navbar-icon-row
= nav_entry t("navigation.timeline"), root_path, icon: 'home', icon_only: true
#nav-inbox-mobile
= nav_entry t("navigation.inbox"), '/inbox',
badge: inbox_count, badge_color: 'primary', badge_pill: true,
icon: 'inbox', icon_only: true
= nav_entry t("navigation.inbox"), '/inbox',
badge: inbox_count, badge_color: 'primary', badge_pill: true,
icon: 'inbox', icon_only: true, id: "nav-inbox-mobile"
- if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod?
= nav_entry t("navigation.discover"), discover_path, icon: 'compass', icon_only: true
= nav_entry t("navigation.notifications"), notifications_path("all"), icon: notifications_icon,