]> git.openstreetmap.org Git - rails.git/commitdiff
Use secondary text color in header menu
authorAnton Khorev <tony29@yandex.ru>
Mon, 8 Apr 2024 14:40:01 +0000 (17:40 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 8 Apr 2024 14:40:01 +0000 (17:40 +0300)
app/assets/stylesheets/common.scss
app/helpers/application_helper.rb
app/views/layouts/_header.html.erb
test/helpers/application_helper_test.rb

index ba976ff2b8996e352ae43ca2a8e1fa31a7433b4c..618ce444ead8d7ec8a77a71e5675a2e29703aa3f 100644 (file)
@@ -150,11 +150,6 @@ nav.primary {
 nav.secondary {
   .nav-link {
     padding: 0.2rem;
-    color: $darkgrey;
-  }
-
-  > ul li.current a {
-    color: darken($darkgrey, 25%);
   }
 
   #inboxanchor {
index 17c36bdfe043066b81c518c9602546f3013af212..368668a9bbf4fbb5c82637595ab0a09560032d56 100644 (file)
@@ -41,8 +41,8 @@ module ApplicationHelper
     end
   end
 
-  def current_page_class(path)
-    :current if current_page?(path)
+  def header_nav_link_class(path)
+    ["nav-link", current_page?(path) ? "text-secondary-emphasis" : "text-secondary"]
   end
 
   def application_data
index 0fafc3c7f25ad9b23fd9b1b20ab0a8d2c148d49f..6a926d69247317cbad1f556a21559c1b786cded5 100644 (file)
   <nav class='secondary'>
     <ul class='mx-1 px-0'>
       <% if Settings.status != "database_offline" && can?(:index, Issue) %>
-        <li class="compact-hide nav-item <%= current_page_class(issues_path) %>">
-          <%= link_to issues_path(:status => "open"), :class => "nav-link" do %>
+        <li class="compact-hide nav-item">
+          <%= link_to issues_path(:status => "open"), :class => header_nav_link_class(issues_path) do %>
             <%= t("layouts.issues") %>
             <%= open_issues_count %>
           <% end -%>
         </li>
       <% end %>
-      <li class="compact-hide nav-item <%= current_page_class(traces_path) %>">
-        <%= link_to t("layouts.gps_traces"), traces_path, :class => "nav-link" %>
+      <li class="compact-hide nav-item">
+        <%= link_to t("layouts.gps_traces"), traces_path, :class => header_nav_link_class(traces_path) %>
       </li>
-      <li class="compact-hide nav-item <%= current_page_class(diary_entries_path) %>">
-        <%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "nav-link" %>
+      <li class="compact-hide nav-item">
+        <%= link_to t("layouts.user_diaries"), diary_entries_path, :class => header_nav_link_class(diary_entries_path) %>
       </li>
-      <li class="compact-hide nav-item <%= current_page_class(communities_path) %>">
-        <%= link_to t("layouts.communities"), communities_path, :class => "nav-link" %>
+      <li class="compact-hide nav-item">
+        <%= link_to t("layouts.communities"), communities_path, :class => header_nav_link_class(communities_path) %>
       </li>
-      <li class="compact-hide nav-item <%= current_page_class(copyright_path) %>">
-        <%= link_to t("layouts.copyright"), copyright_path, :class => "nav-link" %>
+      <li class="compact-hide nav-item">
+        <%= link_to t("layouts.copyright"), copyright_path, :class => header_nav_link_class(copyright_path) %>
       </li>
-      <li class="compact-hide nav-item <%= current_page_class(help_path) %>">
-        <%= link_to t("layouts.help"), help_path, :class => "nav-link" %>
+      <li class="compact-hide nav-item">
+        <%= link_to t("layouts.help"), help_path, :class => header_nav_link_class(help_path) %>
       </li>
-      <li class="compact-hide nav-item <%= current_page_class(about_path) %>">
-        <%= link_to t("layouts.about"), about_path, :class => "nav-link" %>
+      <li class="compact-hide nav-item">
+        <%= link_to t("layouts.about"), about_path, :class => header_nav_link_class(about_path) %>
       </li>
       <li id="compact-secondary-nav" class="dropdown nav-item">
         <button class="dropdown-toggle nav-link btn btn-outline-secondary border-0 bg-white text-secondary" type="button" data-bs-toggle="dropdown"><%= t "layouts.more" %></button>
         <ul class="dropdown-menu">
           <% if Settings.status != "database_offline" && can?(:index, Issue) %>
-            <li class="<%= current_page_class(issues_path) %>">
+            <li>
               <%= link_to issues_path(:status => "open"), :class => "dropdown-item" do %>
                 <%= t("layouts.issues") %>
                 <%= open_issues_count %>
               <% end -%>
             </li>
           <% end %>
-          <li class="<%= current_page_class(traces_path) %>"><%= link_to t("layouts.gps_traces"), traces_path, :class => "dropdown-item" %></li>
-          <li class="<%= current_page_class(diary_entries_path) %>"><%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "dropdown-item" %></li>
-          <li class="<%= current_page_class(communities_path) %>"><%= link_to t("layouts.communities"), communities_path, :class => "dropdown-item" %></li>
-          <li class="<%= current_page_class(copyright_path) %>"><%= link_to t("layouts.copyright"), copyright_path, :class => "dropdown-item" %></li>
-          <li class="<%= current_page_class(help_path) %>"><%= link_to t("layouts.help"), help_path, :class => "dropdown-item" %></li>
-          <li class="<%= current_page_class(about_path) %>"><%= link_to t("layouts.about"), about_path, :class => "dropdown-item" %></li>
+          <li><%= link_to t("layouts.gps_traces"), traces_path, :class => "dropdown-item" %></li>
+          <li><%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "dropdown-item" %></li>
+          <li><%= link_to t("layouts.communities"), communities_path, :class => "dropdown-item" %></li>
+          <li><%= link_to t("layouts.copyright"), copyright_path, :class => "dropdown-item" %></li>
+          <li><%= link_to t("layouts.help"), help_path, :class => "dropdown-item" %></li>
+          <li><%= link_to t("layouts.about"), about_path, :class => "dropdown-item" %></li>
         </ul>
       </li>
     </ul>
index 34120e2078781ad732e69e5664a2e5324093157a..a905090dba6133a8c20908f8ee308a6fbb817015 100644 (file)
@@ -91,5 +91,5 @@ class ApplicationHelperTest < ActionView::TestCase
 
   def test_body_class; end
 
-  def test_current_page_class; end
+  def test_header_nav_link_class; end
 end