From 5665f43cbfdedfd351e71c09ec8f1e8adf9e3b2c Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 2 Feb 2023 18:01:09 +0100
Subject: [PATCH] Fix #787

---
 app/assets/stylesheets/admin/commons/treeview.sass            | 4 ++++
 .../admin/communication/websites/pages/_treebranch.html.erb   | 4 ++--
 app/views/admin/communication/websites/posts/_list.html.erb   | 2 +-
 test/system/.keep                                             | 0
 4 files changed, 7 insertions(+), 3 deletions(-)
 delete mode 100644 test/system/.keep

diff --git a/app/assets/stylesheets/admin/commons/treeview.sass b/app/assets/stylesheets/admin/commons/treeview.sass
index b683239ec..337a11285 100644
--- a/app/assets/stylesheets/admin/commons/treeview.sass
+++ b/app/assets/stylesheets/admin/commons/treeview.sass
@@ -32,6 +32,10 @@
         & > .treeview__children
             display: none
 
+        &--draft
+            .page-title
+                opacity: 0.5
+
         &--opened
             & > .treeview__label
                 & > a .close_btn,
diff --git a/app/views/admin/communication/websites/pages/_treebranch.html.erb b/app/views/admin/communication/websites/pages/_treebranch.html.erb
index 9af88b3f6..0e74778cc 100644
--- a/app/views/admin/communication/websites/pages/_treebranch.html.erb
+++ b/app/views/admin/communication/websites/pages/_treebranch.html.erb
@@ -1,5 +1,5 @@
 <% pages.each do |page| %>
-  <li class="treeview__element js-treeview-element <%= 'treeview__element--empty' unless page.has_children? %>" data-id="<%= page.id %>" data-parent="<%= page.parent_id %>">
+  <li class="treeview__element js-treeview-element <%= 'treeview__element--draft' unless page.published %> <%= 'treeview__element--empty' unless page.has_children? %>" data-id="<%= page.id %>" data-parent="<%= page.parent_id %>">
     <div class="d-flex align-items-center treeview__label border-bottom p-1">
       <%= link_to children_admin_communication_website_page_path(website_id: page.website.id, id: page.id),
                   class: 'js-treeview-openzone d-inline-block p-2 ps-0', style: 'width: 22px', remote: true do %>
@@ -14,7 +14,7 @@
       <% end %>
       <%= link_to page,
                   admin_communication_website_page_path(website_id: page.website.id, id: page.id),
-                  class: "#{'draft' unless page.published?}" %>
+                  class: "page-title" %>
       <% unless page.is_home? %>
         <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span>
       <% end %>
diff --git a/app/views/admin/communication/websites/posts/_list.html.erb b/app/views/admin/communication/websites/posts/_list.html.erb
index 5a570b97c..a0d4eaee1 100644
--- a/app/views/admin/communication/websites/posts/_list.html.erb
+++ b/app/views/admin/communication/websites/posts/_list.html.erb
@@ -22,7 +22,7 @@
     </thead>
     <tbody>
       <% posts.each do |post| %>
-        <tr>
+        <tr <% unless post.published? %>class="draft"<% end %>>
           <% if selectable %>
             <td class="ps-0">
               <%= check_box_tag "ids[]", post.id, false, data: { batch_selectable_role: "select-single" } %>
diff --git a/test/system/.keep b/test/system/.keep
deleted file mode 100644
index e69de29bb..000000000
-- 
GitLab