From cb70670eed84616863eeb7786d328096c9314964 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 23 Jan 2023 12:15:50 +0100
Subject: [PATCH] statics

---
 app/helpers/admin/application_helper.rb                      | 1 +
 app/views/admin/application/_dependencies.html.erb           | 3 ++-
 .../admin/communication/websites/categories/show.html.erb    | 4 +---
 app/views/admin/communication/websites/pages/show.html.erb   | 4 +---
 app/views/admin/communication/websites/posts/show.html.erb   | 4 +---
 app/views/admin/education/diplomas/show.html.erb             | 4 +---
 app/views/admin/education/programs/show.html.erb             | 4 +---
 app/views/admin/research/journals/papers/show.html.erb       | 4 +---
 app/views/admin/research/journals/volumes/show.html.erb      | 4 +---
 app/views/admin/university/organizations/show.html.erb       | 5 +----
 app/views/admin/university/people/show.html.erb              | 5 +----
 11 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb
index a35df6e65..cde3b0187 100644
--- a/app/helpers/admin/application_helper.rb
+++ b/app/helpers/admin/application_helper.rb
@@ -46,6 +46,7 @@ module Admin::ApplicationHelper
   end
 
   def static_link(path)
+    return unless current_user.server_admin?
     raw "<a href=\"#{path}\" class=\"btn btn-light btn-xs\">#{t 'static' }</a>"
   end
 
diff --git a/app/views/admin/application/_dependencies.html.erb b/app/views/admin/application/_dependencies.html.erb
index 740bdeaca..c732511f8 100644
--- a/app/views/admin/application/_dependencies.html.erb
+++ b/app/views/admin/application/_dependencies.html.erb
@@ -10,7 +10,8 @@ expanded ||= false
         aria-expanded="<%= expanded %>"
         aria-controls="dependencies"></i>
   </div>
-  <h2 class="h5 text-muted">Dépendances <small>visible uniquement pour les server admins</small></h2>
+  <p class="text-muted mb-0">Dépendances</p>
+  <p class="small text-muted">Visible uniquement pour les server admins</p>
   <div class="card-body collapse <%= 'show' if expanded %>" id="dependencies">
       <h2 class="h5">git_dependencies</h2>
       <div class="table-responsive">
diff --git a/app/views/admin/communication/websites/categories/show.html.erb b/app/views/admin/communication/websites/categories/show.html.erb
index 64944461b..dc7cec382 100644
--- a/app/views/admin/communication/websites/categories/show.html.erb
+++ b/app/views/admin/communication/websites/categories/show.html.erb
@@ -57,9 +57,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @category %>
-  <%= link_to t('static'),
-              static_admin_communication_website_category_path(@category),
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_communication_website_category_path(@category) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb
index 1a7957147..4012ee619 100644
--- a/app/views/admin/communication/websites/pages/show.html.erb
+++ b/app/views/admin/communication/websites/pages/show.html.erb
@@ -27,9 +27,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @page if @page.is_regular_page? %>
-  <%= link_to t('static'),
-              static_admin_communication_website_page_path(@page),
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_communication_website_page_path(@page) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/communication/websites/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb
index 60cf06183..f21baaa1f 100644
--- a/app/views/admin/communication/websites/posts/show.html.erb
+++ b/app/views/admin/communication/websites/posts/show.html.erb
@@ -53,9 +53,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @post %>
-  <%= link_to t('static'),
-              static_admin_communication_website_post_path(@post),
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_communication_website_post_path(@post) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/education/diplomas/show.html.erb b/app/views/admin/education/diplomas/show.html.erb
index c4aa20e18..8726c1078 100644
--- a/app/views/admin/education/diplomas/show.html.erb
+++ b/app/views/admin/education/diplomas/show.html.erb
@@ -27,9 +27,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @diploma %>
-  <%= link_to t('static'),
-              static_admin_education_diploma_path(@diploma),
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_education_diploma_path(@diploma) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb
index 32ce1a79e..9a06e4265 100644
--- a/app/views/admin/education/programs/show.html.erb
+++ b/app/views/admin/education/programs/show.html.erb
@@ -145,9 +145,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @program %>
-  <%= link_to t('static'),
-              static_admin_education_program_path(@program),
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_education_program_path(@program) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/research/journals/papers/show.html.erb b/app/views/admin/research/journals/papers/show.html.erb
index c6c9c5bee..9bb95d1ab 100644
--- a/app/views/admin/research/journals/papers/show.html.erb
+++ b/app/views/admin/research/journals/papers/show.html.erb
@@ -53,9 +53,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @paper %>
-  <%= link_to t('static'),
-            static_admin_research_journal_paper_path(@paper),
-            class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_research_journal_paper_path(@paper) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/research/journals/volumes/show.html.erb b/app/views/admin/research/journals/volumes/show.html.erb
index b5c16a3d8..e2852145b 100644
--- a/app/views/admin/research/journals/volumes/show.html.erb
+++ b/app/views/admin/research/journals/volumes/show.html.erb
@@ -63,9 +63,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @volume %>
-  <%= link_to t('static'),
-        static_admin_research_journal_volume_path(@volume),
-        class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_research_journal_volume_path(@volume) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb
index 6034ab47d..1359685d1 100644
--- a/app/views/admin/university/organizations/show.html.erb
+++ b/app/views/admin/university/organizations/show.html.erb
@@ -123,10 +123,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @organization %>
-  <%= link_to t('static'),
-              static_admin_university_organization_path(@organization),
-              target: :_blank,
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_university_organization_path(@organization) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/university/people/show.html.erb b/app/views/admin/university/people/show.html.erb
index e4b751669..048600793 100644
--- a/app/views/admin/university/people/show.html.erb
+++ b/app/views/admin/university/people/show.html.erb
@@ -23,10 +23,7 @@
 
 <% content_for :action_bar_left do %>
   <%= destroy_link @person %>
-  <%= link_to t('static'),
-              static_admin_university_person_path(@person),
-              target: :_blank,
-              class: button_classes('btn-light') if current_user.server_admin? %>
+  <%= static_link static_admin_university_person_path(@person) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
-- 
GitLab