From 09633992cdf12ff7a4a0858b17e5cd4b66c9a46d Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 30 Jan 2023 13:55:40 +0100
Subject: [PATCH] preview only correct pages

---
 .../admin/communication/websites/pages_controller.rb            | 1 +
 .../admin/communication/websites/posts_controller.rb            | 1 +
 app/controllers/admin/education/programs_controller.rb          | 1 +
 app/views/admin/layouts/themes/_appstack.html.erb               | 2 +-
 app/views/admin/layouts/themes/_pure.html.erb                   | 2 +-
 5 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/controllers/admin/communication/websites/pages_controller.rb b/app/controllers/admin/communication/websites/pages_controller.rb
index 2c1ce8f3c..4c12a6a2b 100644
--- a/app/controllers/admin/communication/websites/pages_controller.rb
+++ b/app/controllers/admin/communication/websites/pages_controller.rb
@@ -27,6 +27,7 @@ class Admin::Communication::Websites::PagesController < Admin::Communication::We
   end
 
   def show
+    @preview = true
     breadcrumb
     add_breadcrumb(@page, admin_communication_website_page_path(@page))
   end
diff --git a/app/controllers/admin/communication/websites/posts_controller.rb b/app/controllers/admin/communication/websites/posts_controller.rb
index a08c1e0c1..b9d47807d 100644
--- a/app/controllers/admin/communication/websites/posts_controller.rb
+++ b/app/controllers/admin/communication/websites/posts_controller.rb
@@ -33,6 +33,7 @@ class Admin::Communication::Websites::PostsController < Admin::Communication::We
   end
 
   def show
+    @preview = true
     breadcrumb
   end
 
diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb
index 4bc22f329..b193f6384 100644
--- a/app/controllers/admin/education/programs_controller.rb
+++ b/app/controllers/admin/education/programs_controller.rb
@@ -50,6 +50,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro
   def show
     @roles = @program.university_roles.ordered
     @teacher_involvements = @program.university_person_involvements.includes(:person).ordered_by_name
+    @preview = true
     breadcrumb
   end
 
diff --git a/app/views/admin/layouts/themes/_appstack.html.erb b/app/views/admin/layouts/themes/_appstack.html.erb
index 71a382245..8ca84d786 100644
--- a/app/views/admin/layouts/themes/_appstack.html.erb
+++ b/app/views/admin/layouts/themes/_appstack.html.erb
@@ -22,7 +22,7 @@
           </div>
           <%= yield %>
         </div>
-        <%= render 'admin/application/preview' %>
+        <%= render 'admin/application/preview' if @preview %>
       </main>
     </div>
   </div>
diff --git a/app/views/admin/layouts/themes/_pure.html.erb b/app/views/admin/layouts/themes/_pure.html.erb
index 94278bc16..b5bfe97af 100644
--- a/app/views/admin/layouts/themes/_pure.html.erb
+++ b/app/views/admin/layouts/themes/_pure.html.erb
@@ -15,7 +15,7 @@
     <div class="position-relative">
       <%= yield %>
     </div>
-    <%= render 'admin/application/preview' %>
+    <%= render 'admin/application/preview' if @preview %>
   </main>
   <%= render "admin/layouts/themes/pure/commands" %>
   <%= render "admin/layouts/themes/pure/footer" %>
-- 
GitLab