From b5597a7440b1474d684e5fb752a136c3d22b15ab Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Fri, 26 Nov 2021 16:21:37 +0100
Subject: [PATCH] info

---
 .../website/authors/show.html.erb             | 38 ++++---
 .../website/categories/show.html.erb          | 77 +++++++--------
 .../communication/website/pages/show.html.erb | 98 ++++++++-----------
 .../website/posts/_list.html.erb              |  2 +-
 .../website/posts/index.html.erb              |  2 +-
 config/locales/communication/fr.yml           |  4 +-
 6 files changed, 97 insertions(+), 124 deletions(-)

diff --git a/app/views/admin/communication/website/authors/show.html.erb b/app/views/admin/communication/website/authors/show.html.erb
index 5cd49d3c5..238ca1355 100644
--- a/app/views/admin/communication/website/authors/show.html.erb
+++ b/app/views/admin/communication/website/authors/show.html.erb
@@ -18,32 +18,30 @@
         <div class="card-header">
           <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2>
         </div>
-        <table class="<%= table_classes %>">
-          <tbody>
-            <tr>
-              <td width="150"><%= Communication::Website::Author.human_attribute_name('slug') %></td>
-              <td><%= @author.slug %></td>
-            </tr>
-            <% if @author.user %>
-              <tr>
-                <td width="150"><%= Communication::Website::Author.human_attribute_name('user') %></td>
-                <td><%= link_to_if can?(:read, @author.user), @author.user, admin_user_path(@author.user) %></td>
-              </tr>
-            <% end %>
-          </tbody>
-        </table>
+        <div class="card-body">
+          <h3 class="h5"><%= Communication::Website::Author.human_attribute_name('slug') %></h3>
+          <p><%= @author.slug %></p>
+          <h3 class="h5"><%= Communication::Website::Author.human_attribute_name('user') %></h3>
+          <p><%= link_to_if can?(:read, @author.user), @author.user, admin_user_path(@author.user) %></p>
+        </div>
       </div>
     </div>
   </div>
-<% end %>
-
-<% if @posts.total_count > 0 %>
-  <h2><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h2>
+  <% if @posts.total_count > 0 %>
+    <div class="card">
+      <div class="card-header">
+        <h5><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h5>
+      </div>
+      <%= render 'admin/communication/website/posts/list', posts: @posts, hide_author: true %>
+      <div class="card-footer">
+        <%= paginate @posts, theme: 'bootstrap-5' %>
+      </div>
+    </div>
 
-  <%= render 'admin/communication/website/posts/list', posts: @posts, hide_author: true %>
-  <%= paginate @posts, theme: 'bootstrap-5' %>
+  <% end %>
 <% end %>
 
+
 <% content_for :action_bar_left do %>
   <%= link_to t('communication.website.force_publication'),
               publish_admin_communication_website_author_path(@author),
diff --git a/app/views/admin/communication/website/categories/show.html.erb b/app/views/admin/communication/website/categories/show.html.erb
index e10d8ee4a..04e252e98 100644
--- a/app/views/admin/communication/website/categories/show.html.erb
+++ b/app/views/admin/communication/website/categories/show.html.erb
@@ -13,58 +13,51 @@
         </div>
       </div>
     </div>
-
     <div class="col-md-4">
       <div class="card flex-fill w-100">
         <div class="card-header">
           <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2>
         </div>
-        <table class="<%= table_classes %>">
-          <tbody>
-            <tr>
-              <td width="150"><%= Communication::Website::Category.human_attribute_name('slug') %></td>
-              <td><%= @category.slug %></td>
-            </tr>
-            <% if @category.parent %>
-              <tr>
-                <td><%= Communication::Website::Category.human_attribute_name('parent') %></td>
-                <td><%= link_to_if can?(:read, @category.parent),
-                                @category.parent,
+        <div class="card-body">
+          <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('slug') %></h3>
+          <p><%= @category.slug %></p>
+          <% if @category.parent %>
+            <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('parent') %></h3>
+            <p><%= link_to_if can?(:read, @category.parent),
+                            @category.parent,
+                            admin_communication_website_category_path(
+                              website_id: @website.id,
+                              id: @category.parent.id
+                            ) %></p>
+          <% end %>
+          <% if @category.children.any? %>
+            <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('children') %></h3>
+            <ul class="list-unstyled mb-0">
+              <% @category.children.each do |child| %>
+                <li><%= link_to_if can?(:read, child),
+                                child,
                                 admin_communication_website_category_path(
                                   website_id: @website.id,
-                                  id: @category.parent.id
-                                ) %></td>
-              </tr>
-            <% end %>
-            <% if @category.children.any? %>
-              <tr>
-                <td><%= Communication::Website::Category.human_attribute_name('children') %></td>
-                <td>
-                  <ul class="list-unstyled mb-0">
-                    <% @category.children.each do |child| %>
-                      <li><%= link_to_if can?(:read, child),
-                                      child,
-                                      admin_communication_website_category_path(
-                                        website_id: @website.id,
-                                        id: child.id
-                                      ) %></li>
-                    <% end %>
-                  </ul>
-                </td>
-              </tr>
-            <% end %>
-          </tbody>
-        </table>
+                                  id: child.id
+                                ) %></li>
+              <% end %>
+            </ul>
+          <% end %>
+        </div>
       </div>
     </div>
   </div>
-<% end %>
-
-<% if @posts.total_count > 0 %>
-  <h2><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h2>
-
-  <%= render 'admin/communication/website/posts/list', posts: @posts, hide_category: true %>
-  <%= paginate @posts, theme: 'bootstrap-5' %>
+  <% if @posts.total_count > 0 %>
+    <div class="card">
+      <div class="card-header">
+        <h5><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h5>
+      </div>
+      <%= render 'admin/communication/website/posts/list', posts: @posts, hide_category: true %>
+      <div class="card-footer">
+        <%= paginate @posts, theme: 'bootstrap-5' %>
+      </div>
+    </div>
+  <% end %>
 <% end %>
 
 <% content_for :action_bar_left do %>
diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/website/pages/show.html.erb
index d9ae753d6..3487ac7eb 100644
--- a/app/views/admin/communication/website/pages/show.html.erb
+++ b/app/views/admin/communication/website/pages/show.html.erb
@@ -22,64 +22,46 @@
         <div class="card-header">
           <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2>
         </div>
-        <table class="<%= table_classes %>">
-          <tbody>
-            <tr>
-              <td width="150"><%= Communication::Website::Page.human_attribute_name('slug') %></td>
-              <td><%= @page.slug %></td>
-            </tr>
-            <tr>
-              <td><%= Communication::Website::Page.human_attribute_name('path') %></td>
-              <td><%= @page.path %></td>
-            </tr>
-            <tr>
-              <td><%= Communication::Website::Page.human_attribute_name('published') %></td>
-              <td>
-                <%= t @page.published %>
-              </td>
-            </tr>
-            <% if @page.parent %>
-              <tr>
-                <td><%= Communication::Website::Page.human_attribute_name('parent') %></td>
-                <td><%= link_to_if can?(:read, @page.parent),
-                                @page.parent,
-                                admin_communication_website_page_path(
-                                  website_id: @website.id,
-                                  id: @page.parent.id
-                                ),
-                                class: "#{'opacity-50' unless @page.parent.published?}" %></td>
-              </tr>
-            <% end %>
-            <% if @page.related_category %>
-              <tr>
-                <td><%= Communication::Website::Page.human_attribute_name('related_category') %></td>
-                <td><%= link_to_if can?(:read, @page.related_category),
-                                @page.related_category,
-                                admin_communication_website_category_path(
-                                  website_id: @website.id,
-                                  id: @page.related_category.id
-                                ) %></td>
-              </tr>
-            <% end %>
-            <% if @page.children.any? %>
-              <tr>
-                <td><%= Communication::Website::Page.human_attribute_name('children') %></td>
-                <td>
-                  <ul class="list-unstyled mb-0">
-                    <% @page.children.each do |child| %>
-                      <li>
-                        <%= link_to_if can?(:read, child),
-                                      child,
-                                      admin_communication_website_page_path( website_id: @website.id, id: child.id),
-                                      class: "#{'opacity-50' unless child.published?}" %>
-                      </li>
-                    <% end %>
-                  </ul>
-                </td>
-              </tr>
-            <% end %>
-          </tbody>
-        </table>
+        <div class="card-body">
+          <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('slug') %></h3>
+          <p><%= @page.slug %></p>
+          <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('path') %></h3>
+          <p><%= @page.path %></p>
+          <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('published') %></h3>
+          <p><%= t @page.published %></p>
+          <% if @page.parent %>
+            <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('parent') %></h3>
+            <p><%= link_to_if can?(:read, @page.parent),
+                              @page.parent,
+                              admin_communication_website_page_path(
+                                website_id: @website.id,
+                                id: @page.parent.id
+                              ),
+                              class: "#{'opacity-50' unless @page.parent.published?}" %></p>
+          <% end %>
+          <% if @page.related_category %>
+            <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('related_category') %></h3>
+            <p><%= link_to_if can?(:read, @page.related_category),
+                              @page.related_category,
+                              admin_communication_website_category_path(
+                                website_id: @website.id,
+                                id: @page.related_category.id
+                              ) %></p>
+          <% end %>
+          <% if @page.children.any? %>
+            <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('children') %></h3>
+            <ul class="list-unstyled mb-0">
+              <% @page.children.each do |child| %>
+                <li>
+                  <%= link_to_if can?(:read, child),
+                                child,
+                                admin_communication_website_page_path( website_id: @website.id, id: child.id),
+                                class: "#{'opacity-50' unless child.published?}" %>
+                </li>
+              <% end %>
+            </ul>
+          <% end %>
+        </div>
       </div>
       <% if @page.featured_image.attached? && @page.featured_image.variable? %>
         <div class="card flex-fill w-100">
diff --git a/app/views/admin/communication/website/posts/_list.html.erb b/app/views/admin/communication/website/posts/_list.html.erb
index d5a9cd7af..210c0b54a 100644
--- a/app/views/admin/communication/website/posts/_list.html.erb
+++ b/app/views/admin/communication/website/posts/_list.html.erb
@@ -36,7 +36,7 @@
             </ul>
           </td>
         <% end %>
-        <td><small><%= l post.published_at, format: :date_with_hour if post.published_at %></small></td>
+        <td><small><%= l post.published_at, format: :date_with_explicit_month if post.published_at %></small></td>
         <td class="text-end">
           <div class="btn-group" role="group">
             <%= link_to t('edit'),
diff --git a/app/views/admin/communication/website/posts/index.html.erb b/app/views/admin/communication/website/posts/index.html.erb
index 94204ff97..ed951db10 100644
--- a/app/views/admin/communication/website/posts/index.html.erb
+++ b/app/views/admin/communication/website/posts/index.html.erb
@@ -2,7 +2,7 @@
 
 <%= render 'admin/communication/websites/sidebar' do %>
   <div class="card">
-    <%= render 'admin/communication/website/posts/list', posts: @posts %>
+    <%= render 'admin/communication/website/posts/list', posts: @posts, hide_author: true, hide_category: true %>
     <div class="card-footer">
       <%= paginate @posts, theme: 'bootstrap-5' %>
     </div>
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index 114547f69..28646c587 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -70,7 +70,7 @@ fr:
         slug: Slug
         user: Utilisateur
       communication/website/category:
-        children: Catégories enfantes
+        children: Catégories enfants
         description: Description
         name: Nom
         parent: Catégorie parente
@@ -94,7 +94,7 @@ fr:
         url: URL
       communication/website/page:
         related_category: Catégorie liée
-        children: Pages enfantes
+        children: Pages enfants
         description: Description (SEO)
         featured_image: Image à la une
         parent: Page parente
-- 
GitLab