From 288b9c4cc0c31dc290f0c7a74faf0576a6cde270 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Fri, 10 Feb 2023 14:46:59 +0100
Subject: [PATCH] fix

---
 app/services/osuny/simple_navigation_renderer.rb    | 2 +-
 app/views/admin/dashboard/index.html.erb            | 6 +++---
 app/views/admin/layouts/themes/pure/_nav.html.erb   | 2 +-
 app/views/admin/layouts/themes/pure/_panel.html.erb | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/app/services/osuny/simple_navigation_renderer.rb b/app/services/osuny/simple_navigation_renderer.rb
index 6fd290602..b6857b68e 100644
--- a/app/services/osuny/simple_navigation_renderer.rb
+++ b/app/services/osuny/simple_navigation_renderer.rb
@@ -33,7 +33,7 @@ class Osuny::SimpleNavigationRenderer < SimpleNavigation::Renderer::Base
     if item.options.has_key? :image
       image = item.options[:image]
       part += "<a href=\"#{item.url}\">"
-      part += ActionController::Base.helpers.image_tag image, class: 'image'
+      part += ActionController::Base.helpers.image_tag image, class: 'image', loading: :lazy
       part += "</a>"
     end
     part += "<h2>#{item_name_and_link}</h2>"
diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb
index 371d61af2..2a52a293a 100644
--- a/app/views/admin/dashboard/index.html.erb
+++ b/app/views/admin/dashboard/index.html.erb
@@ -86,11 +86,11 @@
 <div class="row mt-5 pt-5">
   <% @namespaces.each do |namespace| %>
     <% 
-    path = send "admin_#{namespace.to_s.downcase}_root_path"
-    description = t "#{namespace.to_s.downcase}.description.text"
+    path = send "admin_#{namespace.to_s.underscore}_root_path"
+    description = t "#{namespace.to_s.underscore}.description.text"
     %>
   <div class="col-lg-3">
-    <%= osuny_panel namespace.model_name.human, image: "admin/#{namespace.to_s.downcase}.jpg" do %>
+    <%= osuny_panel namespace.model_name.human, image: "admin/#{namespace.to_s.underscore}.jpg" do %>
       <p><%= description.truncate 180 %></p>
       <%= link_to t('show'), path, class: 'stretched-link' %>
     <% end %>
diff --git a/app/views/admin/layouts/themes/pure/_nav.html.erb b/app/views/admin/layouts/themes/pure/_nav.html.erb
index 2ced5b0cf..e55f8cd2d 100644
--- a/app/views/admin/layouts/themes/pure/_nav.html.erb
+++ b/app/views/admin/layouts/themes/pure/_nav.html.erb
@@ -50,7 +50,7 @@ context ||= :admin
             image = 'avatar.jpg'
           end
           %>
-          <%= image_tag image, class: 'image' %>
+          <%= image_tag image, class: 'image', loading: :lazy %>
           <h2><%= link_to current_user.to_s, admin_user_path(current_user) %></h2>
           <ul>
             <li><%= link_to t('menu.profile'), edit_user_registration_path %></li>
diff --git a/app/views/admin/layouts/themes/pure/_panel.html.erb b/app/views/admin/layouts/themes/pure/_panel.html.erb
index e4f003313..622f74dd9 100644
--- a/app/views/admin/layouts/themes/pure/_panel.html.erb
+++ b/app/views/admin/layouts/themes/pure/_panel.html.erb
@@ -1,5 +1,5 @@
 <section class="pure__section flex-fill position-relative">
-  <%= image_tag image, class: 'img-fluid mb-3' if image %>
+  <%= image_tag image, class: 'img-fluid mb-3', loading: :lazy if image %>
   <% if action %>
     <div class="float-end"><%= raw action %></div>
   <% end %>
-- 
GitLab