From 44e3a393a0fe0fba8e83080fc5dea00506a31dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 10 Jan 2023 16:42:57 +0100 Subject: [PATCH] Move navigation and footer partials to components This way it'll be easier to decide when they should be rendered. In order to be consistent, we're using the `Layout` module for both components; previously, the navigation partial was in the `shared` folder while the footer partial was in the `layout` folder, which IMHO didn't make much sense. --- .../layout/footer_component.html.erb} | 0 app/components/layout/footer_component.rb | 2 ++ .../layout/subnavigation_component.html.erb} | 0 app/components/layout/subnavigation_component.rb | 3 +++ app/views/layouts/_header.html.erb | 4 ++-- app/views/layouts/application.html.erb | 2 +- app/views/layouts/devise.html.erb | 2 +- 7 files changed, 9 insertions(+), 4 deletions(-) rename app/{views/layouts/_footer.html.erb => components/layout/footer_component.html.erb} (100%) create mode 100644 app/components/layout/footer_component.rb rename app/{views/shared/_subnavigation.html.erb => components/layout/subnavigation_component.html.erb} (100%) create mode 100644 app/components/layout/subnavigation_component.rb diff --git a/app/views/layouts/_footer.html.erb b/app/components/layout/footer_component.html.erb similarity index 100% rename from app/views/layouts/_footer.html.erb rename to app/components/layout/footer_component.html.erb diff --git a/app/components/layout/footer_component.rb b/app/components/layout/footer_component.rb new file mode 100644 index 000000000..b9e0fe5de --- /dev/null +++ b/app/components/layout/footer_component.rb @@ -0,0 +1,2 @@ +class Layout::FooterComponent < ApplicationComponent +end diff --git a/app/views/shared/_subnavigation.html.erb b/app/components/layout/subnavigation_component.html.erb similarity index 100% rename from app/views/shared/_subnavigation.html.erb rename to app/components/layout/subnavigation_component.html.erb diff --git a/app/components/layout/subnavigation_component.rb b/app/components/layout/subnavigation_component.rb new file mode 100644 index 000000000..57f12a683 --- /dev/null +++ b/app/components/layout/subnavigation_component.rb @@ -0,0 +1,3 @@ +class Layout::SubnavigationComponent < ApplicationComponent + delegate :content_block, :layout_menu_link_to, to: :helpers +end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 2351ddba8..bf1884f93 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -30,7 +30,7 @@
@@ -40,7 +40,7 @@ diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index cc4db0fca..7ed3b55b1 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -32,7 +32,7 @@