From 67d8156e7b7ffb7f99ac35f3c1b61f6ff6d278b1 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 24 Jul 2023 12:37:37 +0200
Subject: [PATCH] domains

---
 .../communication/websites_controller.rb      | 29 +++++++++++--------
 .../communication/websites/security.html.erb  |  2 +-
 .../communication/websites/show.html.erb      |  1 +
 .../communication/websites/static.html.erb    |  4 +++
 config/routes/admin/communication.rb          |  3 +-
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb
index 790967b16..647071049 100644
--- a/app/controllers/admin/communication/websites_controller.rb
+++ b/app/controllers/admin/communication/websites_controller.rb
@@ -7,14 +7,6 @@ class Admin::Communication::WebsitesController < Admin::Communication::Websites:
     breadcrumb
   end
 
-  def show
-    @all_pages = @website.pages.accessible_by(current_ability).for_language(current_website_language)
-    @pages = @all_pages.recent
-    @all_posts = @website.posts.accessible_by(current_ability).for_language(current_website_language)
-    @posts = @all_posts.recent
-    breadcrumb
-  end
-
   def analytics
     breadcrumb
     add_breadcrumb t('communication.website.analytics')
@@ -25,10 +17,6 @@ class Admin::Communication::WebsitesController < Admin::Communication::Websites:
     add_breadcrumb t('communication.website.security')
   end
 
-  def new
-    breadcrumb
-  end
-
   def import
     if request.post?
       @website.import!
@@ -45,6 +33,23 @@ class Admin::Communication::WebsitesController < Admin::Communication::Websites:
     add_breadcrumb Communication::Website::Imported::Website.model_name.human
   end
 
+  def show
+    @all_pages = @website.pages.accessible_by(current_ability).for_language(current_website_language)
+    @pages = @all_pages.recent
+    @all_posts = @website.posts.accessible_by(current_ability).for_language(current_website_language)
+    @posts = @all_posts.recent
+    breadcrumb
+  end
+
+  def static
+    @about = @website
+    render layout: false
+  end
+
+  def new
+    breadcrumb
+  end
+
   def edit
     breadcrumb
     add_breadcrumb t('edit')
diff --git a/app/views/admin/communication/websites/security.html.erb b/app/views/admin/communication/websites/security.html.erb
index 9b9212efa..7d5b7e0da 100644
--- a/app/views/admin/communication/websites/security.html.erb
+++ b/app/views/admin/communication/websites/security.html.erb
@@ -1,7 +1,7 @@
 <% content_for :title, t('communication.website.security') %>
 
 <%= osuny_panel "CSP" do %>
-  <ul>
+  <ul class="list-unstyled">
     <% @website.external_domains.each do |domain| %>
       <li><%= domain %></li>
     <% end %>
diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb
index e7be9bca6..18bb57db4 100644
--- a/app/views/admin/communication/websites/show.html.erb
+++ b/app/views/admin/communication/websites/show.html.erb
@@ -33,6 +33,7 @@
                   class: button_classes %>
     <% end %>
   <% end %>
+  <%= static_link static_admin_communication_website_path(@website) %>
 <% end %>
 
 <% content_for :action_bar_right do %>
diff --git a/app/views/admin/communication/websites/static.html.erb b/app/views/admin/communication/websites/static.html.erb
index 410015a86..3e04361f3 100644
--- a/app/views/admin/communication/websites/static.html.erb
+++ b/app/views/admin/communication/websites/static.html.erb
@@ -1,2 +1,6 @@
 title: >
   <%= @about.to_s %>
+external_domains:
+<% @website.external_domains.each do |domain| %>
+  - "<%= domain %>"
+<% end %>
\ No newline at end of file
diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb
index 29ce50cfe..860d470eb 100644
--- a/config/routes/admin/communication.rb
+++ b/config/routes/admin/communication.rb
@@ -5,10 +5,11 @@ namespace :communication do
   end
   resources :websites do
     member do
-      get :import
       post :import
+      get :import
       get :analytics
       get :security
+      get :static
     end
     get 'style' => 'websites/preview#style', as: :style
     get 'assets/*path' => 'websites/preview#assets'
-- 
GitLab