From 383dacbf05a1a98d9eb32ac9a2092991a61c59e4 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 29 Jun 2023 14:01:47 +0200
Subject: [PATCH] wip

---
 .../admin/communication/websites/pages_controller.rb          | 4 ++--
 app/models/communication/website/page/accessibility.rb        | 2 +-
 app/models/communication/website/page/with_type.rb            | 3 +++
 config/routes/admin/communication.rb                          | 2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/app/controllers/admin/communication/websites/pages_controller.rb b/app/controllers/admin/communication/websites/pages_controller.rb
index 884bfd595..cad0b279a 100644
--- a/app/controllers/admin/communication/websites/pages_controller.rb
+++ b/app/controllers/admin/communication/websites/pages_controller.rb
@@ -58,8 +58,8 @@ class Admin::Communication::Websites::PagesController < Admin::Communication::We
     redirect_back(fallback_location: [:admin, @object])
   end
 
-  def generate
-    @page.generate
+  def generate_from_template
+    @page.generate_from_template
     redirect_back(fallback_location: [:admin, @page])
   end
 
diff --git a/app/models/communication/website/page/accessibility.rb b/app/models/communication/website/page/accessibility.rb
index 939cba9ba..d88be5e40 100644
--- a/app/models/communication/website/page/accessibility.rb
+++ b/app/models/communication/website/page/accessibility.rb
@@ -52,7 +52,7 @@ class Communication::Website::Page::Accessibility < Communication::Website::Page
     false
   end
 
-  def generate
+  def generate_from_template
     generate_declaration
     generate_results
     generate_conformity
diff --git a/app/models/communication/website/page/with_type.rb b/app/models/communication/website/page/with_type.rb
index 97e85fb27..9be494210 100644
--- a/app/models/communication/website/page/with_type.rb
+++ b/app/models/communication/website/page/with_type.rb
@@ -85,6 +85,9 @@ module Communication::Website::Page::WithType
     nil
   end
 
+  def generate_from_template
+  end
+
   protected
 
   def default_parent
diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb
index 2bf8317ec..94a5fe3e4 100644
--- a/config/routes/admin/communication.rb
+++ b/config/routes/admin/communication.rb
@@ -25,7 +25,7 @@ namespace :communication do
         post :duplicate
         post :connect
         post :disconnect
-        post :generate
+        post 'generate-from-template' => 'websites/pages#generate_from_template', as: :generate
       end
     end
     resources :categories, controller: 'websites/categories', path: '/:lang/categories' do
-- 
GitLab