From 916f527efcd61f08e5b9490541dbcf55d51d180c Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Fri, 10 Mar 2023 10:14:27 +0100
Subject: [PATCH] back-office done

---
 .../extranets/documents/categories/_list.html.erb   |  3 ++-
 .../extranets/documents/categories/show.html.erb    |  6 ++++--
 .../extranets/documents/index.html.erb              |  5 +++--
 .../extranets/documents/kinds/_list.html.erb        |  3 ++-
 .../extranets/documents/kinds/show.html.erb         |  6 ++++--
 .../communication/extranets/documents/show.html.erb |  4 ++--
 .../extranets/posts/categories/_list.html.erb       |  3 ++-
 .../extranets/posts/categories/show.html.erb        |  6 ++++--
 .../communication/extranets/posts/index.html.erb    |  5 +++--
 config/locales/communication/en.yml                 | 13 +++++++++++++
 config/locales/communication/fr.yml                 | 13 +++++++++++++
 11 files changed, 52 insertions(+), 15 deletions(-)

diff --git a/app/views/admin/communication/extranets/documents/categories/_list.html.erb b/app/views/admin/communication/extranets/documents/categories/_list.html.erb
index 3bf6eb7f2..45650a1d6 100644
--- a/app/views/admin/communication/extranets/documents/categories/_list.html.erb
+++ b/app/views/admin/communication/extranets/documents/categories/_list.html.erb
@@ -3,6 +3,7 @@
     <thead>
       <tr>
         <th class="ps-0" width="60%"><%= Communication::Extranet::Document::Category.human_attribute_name('name') %></th>
+        <th><%= Communication::Extranet::Document::Category.human_attribute_name('quantity') %></th>
         <th></th>
       </tr>
     </thead>
@@ -10,7 +11,7 @@
       <% categories.each do |category| %>
         <tr>
           <td class="ps-0"><%= link_to category, admin_communication_extranet_document_category_path(extranet_id: category.extranet.id, id: category.id) %></td>
-
+          <td><%= category.documents.count %></td>
           <td>
             <div class="btn-group" role="group">
               <%= link_to t('edit'),
diff --git a/app/views/admin/communication/extranets/documents/categories/show.html.erb b/app/views/admin/communication/extranets/documents/categories/show.html.erb
index 96479dd7b..535fe68ca 100644
--- a/app/views/admin/communication/extranets/documents/categories/show.html.erb
+++ b/app/views/admin/communication/extranets/documents/categories/show.html.erb
@@ -1,8 +1,10 @@
 <% content_for :title, @category %>
 
 <%= render 'admin/communication/extranets/sidebar' do %>
-  <%= render 'admin/communication/extranets/documents/list', documents: @documents %>
-  <%= paginate @documents, theme: 'bootstrap-5' %>
+  <%= osuny_panel Communication::Extranet::Document.model_name.human(count: 2) do %>
+    <%= render 'admin/communication/extranets/documents/list', documents: @documents %>
+    <%= paginate @documents, theme: 'bootstrap-5' %>
+  <% end %>
 <% end %>
 
 <% content_for :action_bar_left do %>
diff --git a/app/views/admin/communication/extranets/documents/index.html.erb b/app/views/admin/communication/extranets/documents/index.html.erb
index 9f92cca16..8e93fb219 100644
--- a/app/views/admin/communication/extranets/documents/index.html.erb
+++ b/app/views/admin/communication/extranets/documents/index.html.erb
@@ -1,10 +1,11 @@
 <% content_for :title, Communication::Extranet.human_attribute_name(:feature_library) %>
 
 <%= render 'admin/communication/extranets/sidebar' do %>
-  <section class="mb-5">
+  <% action = create_link Communication::Extranet::Document %>
+  <%= osuny_panel Communication::Extranet::Document.model_name.human(count: 2), action: action do %>
     <%= render 'admin/communication/extranets/documents/list', documents: @documents %>
     <%= paginate @documents, theme: 'bootstrap-5' %>
-  </section>
+  <% end %>
 
   <% action = link_to t('create'), new_admin_communication_extranet_document_category_path, class: button_classes %>
   <%= osuny_panel Communication::Extranet::Document::Category.model_name.human(count: 2), action: action do %>
diff --git a/app/views/admin/communication/extranets/documents/kinds/_list.html.erb b/app/views/admin/communication/extranets/documents/kinds/_list.html.erb
index 602b8e38b..b481ebd54 100644
--- a/app/views/admin/communication/extranets/documents/kinds/_list.html.erb
+++ b/app/views/admin/communication/extranets/documents/kinds/_list.html.erb
@@ -3,6 +3,7 @@
     <thead>
       <tr>
         <th class="ps-0" width="60%"><%= Communication::Extranet::Post::Category.human_attribute_name('name') %></th>
+        <th><%= Communication::Extranet::Document::Kind.human_attribute_name('quantity') %></th>
         <th></th>
       </tr>
     </thead>
@@ -10,7 +11,7 @@
       <% kinds.each do |kind| %>
         <tr>
           <td class="ps-0"><%= link_to kind, admin_communication_extranet_document_kind_path(extranet_id: kind.extranet.id, id: kind.id) %></td>
-
+          <td><%= kind.documents.count %></td>
           <td>
             <div class="btn-group" role="group">
               <%= link_to t('edit'),
diff --git a/app/views/admin/communication/extranets/documents/kinds/show.html.erb b/app/views/admin/communication/extranets/documents/kinds/show.html.erb
index 2710035a8..e510fd64a 100644
--- a/app/views/admin/communication/extranets/documents/kinds/show.html.erb
+++ b/app/views/admin/communication/extranets/documents/kinds/show.html.erb
@@ -1,8 +1,10 @@
 <% content_for :title, @kind %>
 
 <%= render 'admin/communication/extranets/sidebar' do %>
-  <%= render 'admin/communication/extranets/documents/list', documents: @documents %>
-  <%= paginate @documents, theme: 'bootstrap-5' %>
+  <%= osuny_panel Communication::Extranet::Document.model_name.human(count: 2) do %>
+    <%= render 'admin/communication/extranets/documents/list', documents: @documents %>
+    <%= paginate @documents, theme: 'bootstrap-5' %>
+  <% end %>
 <% end %>
 
 <% content_for :action_bar_left do %>
diff --git a/app/views/admin/communication/extranets/documents/show.html.erb b/app/views/admin/communication/extranets/documents/show.html.erb
index 1b7e2da24..5a1494f75 100644
--- a/app/views/admin/communication/extranets/documents/show.html.erb
+++ b/app/views/admin/communication/extranets/documents/show.html.erb
@@ -16,11 +16,11 @@
           <% end %>
         </p>
         <% if @document.category %>
-          <%= osuny_label Communication::Extranet::Document.human_attribute_name('category') %>
+          <%= osuny_label Communication::Extranet::Document::Category.model_name.human %>
           <p><%= link_to @document.category, [:admin, @document.category] %></p>
         <% end %>
         <% if @document.kind %>
-          <%= osuny_label Communication::Extranet::Document.human_attribute_name('kind') %>
+          <%= osuny_label Communication::Extranet::Document::Kind.model_name.human %>
           <p><%= link_to @document.kind, [:admin, @document.kind] %></p>
         <% end %>
       <% end %>
diff --git a/app/views/admin/communication/extranets/posts/categories/_list.html.erb b/app/views/admin/communication/extranets/posts/categories/_list.html.erb
index e553d2d00..e865a434c 100644
--- a/app/views/admin/communication/extranets/posts/categories/_list.html.erb
+++ b/app/views/admin/communication/extranets/posts/categories/_list.html.erb
@@ -3,6 +3,7 @@
     <thead>
       <tr>
         <th class="ps-0" width="60%"><%= Communication::Extranet::Post::Category.human_attribute_name('name') %></th>
+        <th><%= Communication::Extranet::Post::Category.human_attribute_name('quantity') %></th>
         <th></th>
       </tr>
     </thead>
@@ -10,7 +11,7 @@
       <% categories.each do |category| %>
         <tr>
           <td class="ps-0"><%= link_to category, admin_communication_extranet_post_category_path(extranet_id: category.extranet.id, id: category.id) %></td>
-
+          <td><%= category.posts.count %></td>
           <td>
             <div class="btn-group" role="group">
               <%= link_to t('edit'),
diff --git a/app/views/admin/communication/extranets/posts/categories/show.html.erb b/app/views/admin/communication/extranets/posts/categories/show.html.erb
index 30f2bd037..fce1b0250 100644
--- a/app/views/admin/communication/extranets/posts/categories/show.html.erb
+++ b/app/views/admin/communication/extranets/posts/categories/show.html.erb
@@ -1,8 +1,10 @@
 <% content_for :title, @category %>
 
 <%= render 'admin/communication/extranets/sidebar' do %>
-  <%= render 'admin/communication/extranets/posts/list', posts: @posts %>
-  <%= paginate @posts, theme: 'bootstrap-5' %>
+  <%= osuny_panel Communication::Extranet::Document.model_name.human(count: 2) do %>
+    <%= render 'admin/communication/extranets/posts/list', posts: @posts %>
+    <%= paginate @posts, theme: 'bootstrap-5' %>
+  <% end %>
 <% end %>
 
 <% content_for :action_bar_left do %>
diff --git a/app/views/admin/communication/extranets/posts/index.html.erb b/app/views/admin/communication/extranets/posts/index.html.erb
index 831db566e..9b081ed3b 100644
--- a/app/views/admin/communication/extranets/posts/index.html.erb
+++ b/app/views/admin/communication/extranets/posts/index.html.erb
@@ -1,10 +1,11 @@
 <% content_for :title, Communication::Extranet.human_attribute_name(:feature_posts) %>
 
 <%= render 'admin/communication/extranets/sidebar' do %>
-  <section class="mb-5">
+  <% action = create_link Communication::Extranet::Post %>
+  <%= osuny_panel Communication::Extranet::Post.model_name.human(count: 2), action: action do %>
     <%= render 'admin/communication/extranets/posts/list', posts: @posts %>
     <%= paginate @posts, theme: 'bootstrap-5' %>
-  </section>
+  <% end %>
 
   <% action = link_to t('create'), new_admin_communication_extranet_post_category_path, class: button_classes %>
   <%= osuny_panel Communication::Extranet::Post::Category.model_name.human(count: 2), action: action do %>
diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml
index 66cb912bd..0cbf12fc4 100644
--- a/config/locales/communication/en.yml
+++ b/config/locales/communication/en.yml
@@ -15,6 +15,12 @@ en:
       communication/extranet/document:
         one: Document
         other: Documents
+      communication/extranet/document/category:
+        one: Category
+        other: Categories
+      communication/extranet/document/kind:
+        one: Kind
+        other: Kinds
       communication/extranet/post:
         one: Post
         other: Posts
@@ -88,6 +94,12 @@ en:
         name: Name
         published: Published?
         published_at: Publication date
+      communication/extranet/document/category:
+        name: Name
+        quantity: Quantity of documents
+      communication/extranet/document/kind:
+        name: Name
+        quantity: Quantity of documents
       communication/extranet/post:
         author: Author
         category: Category
@@ -100,6 +112,7 @@ en:
         title: Title
       communication/extranet/post/category:
         name: Name
+        quantity: Quantity of posts
       communication/website:
         about: About
         about_: Independent website
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index d5129e4f8..d892c6151 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -15,6 +15,12 @@ fr:
       communication/extranet/document:
         one: Document
         other: Documents
+      communication/extranet/document/category:
+        one: Catégorie
+        other: Catégories
+      communication/extranet/document/kind:
+        one: Type
+        other: Types
       communication/extranet/post:
         one: Actualité
         other: Actualités
@@ -88,6 +94,12 @@ fr:
         name: Nom
         published: Publié ?
         published_at: Date de publication
+      communication/extranet/document/category:
+        name: Nom
+        quantity: Quantité de documents
+      communication/extranet/document/kind:
+        name: Nom
+        quantity: Quantité de documents
       communication/extranet/post:
         author: Auteur·rice
         category: Catégorie
@@ -100,6 +112,7 @@ fr:
         title: Titre
       communication/extranet/post/category:
         name: Nom
+        quantity: Quantité d'actualités
       communication/website:
         about: Sujet du site
         about_: Site indépendant
-- 
GitLab