From 3bd5a42274285dfaccc6effe70f0f30a42145c0e Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 24 Aug 2023 09:35:07 +0100 Subject: [PATCH 1/4] Move legacy JS into a separate sub-directory I'm planning to add more non-legacy JS and this change will make that easier. --- app/assets/javascripts/{ => legacy}/modules/chosen.js | 0 app/assets/javascripts/{ => legacy}/modules/dropdown_filter.js | 0 app/assets/javascripts/legacy_layout.js | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename app/assets/javascripts/{ => legacy}/modules/chosen.js (100%) rename app/assets/javascripts/{ => legacy}/modules/dropdown_filter.js (100%) diff --git a/app/assets/javascripts/modules/chosen.js b/app/assets/javascripts/legacy/modules/chosen.js similarity index 100% rename from app/assets/javascripts/modules/chosen.js rename to app/assets/javascripts/legacy/modules/chosen.js diff --git a/app/assets/javascripts/modules/dropdown_filter.js b/app/assets/javascripts/legacy/modules/dropdown_filter.js similarity index 100% rename from app/assets/javascripts/modules/dropdown_filter.js rename to app/assets/javascripts/legacy/modules/dropdown_filter.js diff --git a/app/assets/javascripts/legacy_layout.js b/app/assets/javascripts/legacy_layout.js index 4cb8c28bd..517f999f0 100644 --- a/app/assets/javascripts/legacy_layout.js +++ b/app/assets/javascripts/legacy_layout.js @@ -1,3 +1,3 @@ //= require chosen.jquery -//= require_directory ./modules +//= require_directory ./legacy/modules //= require zeroclipboard From a186f0285361dad7a62cae3efaa6d9ea99478e6c Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 24 Aug 2023 09:50:02 +0100 Subject: [PATCH 2/4] Remove redundant link from manifest Since the app/assets/config/manifest.js already has the following line: //= link application.js And app/assets/javascripts/application.js already has the following line: //= require password-strength-indicator The following line in app/assets/config/manifest.js is redundant: //= link password-strength-indicator.js --- app/assets/config/manifest.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index ff4e3680a..e1d6e089d 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -3,4 +3,3 @@ //= link legacy_layout.css //= link application.js //= link legacy_layout.js -//= link password-strength-indicator.js From 85ccb09ad6e8a87d2410eb519a3f2799519e6539 Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 24 Aug 2023 09:54:26 +0100 Subject: [PATCH 3/4] Move non-legacy JS module into a separate sub-directory I've used require_tree so that we won't need to change app/assets/javascripts/application.js every time we add/remove a module. This seems to be consistent with what other GOV.UK apps are doing. I'm planning to add more non-legacy JS and this change will make that easier. --- app/assets/javascripts/application.js | 2 +- .../javascripts/{ => modules}/password-strength-indicator.js | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename app/assets/javascripts/{ => modules}/password-strength-indicator.js (100%) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 3bd41fcf6..325bdc298 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,4 +1,4 @@ //= require govuk_publishing_components/dependencies //= require govuk_publishing_components/all_components -//= require password-strength-indicator +//= require_tree ./modules //= require rails-ujs diff --git a/app/assets/javascripts/password-strength-indicator.js b/app/assets/javascripts/modules/password-strength-indicator.js similarity index 100% rename from app/assets/javascripts/password-strength-indicator.js rename to app/assets/javascripts/modules/password-strength-indicator.js From 458b839c23d0b4263beda406bb4b94279cace703 Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 24 Aug 2023 10:01:41 +0100 Subject: [PATCH 4/4] Move legacy CSS into a separate sub-directory I'm planning to add more non-legacy CSS and this change will make that easier. --- app/assets/stylesheets/{ => legacy}/_admin.scss | 0 .../stylesheets/{ => legacy}/_bootstrap_chosen.scss | 0 app/assets/stylesheets/{ => legacy}/_filters.scss | 0 app/assets/stylesheets/{ => legacy}/_thin_form.scss | 0 app/assets/stylesheets/legacy_layout.scss | 8 ++++---- 5 files changed, 4 insertions(+), 4 deletions(-) rename app/assets/stylesheets/{ => legacy}/_admin.scss (100%) rename app/assets/stylesheets/{ => legacy}/_bootstrap_chosen.scss (100%) rename app/assets/stylesheets/{ => legacy}/_filters.scss (100%) rename app/assets/stylesheets/{ => legacy}/_thin_form.scss (100%) diff --git a/app/assets/stylesheets/_admin.scss b/app/assets/stylesheets/legacy/_admin.scss similarity index 100% rename from app/assets/stylesheets/_admin.scss rename to app/assets/stylesheets/legacy/_admin.scss diff --git a/app/assets/stylesheets/_bootstrap_chosen.scss b/app/assets/stylesheets/legacy/_bootstrap_chosen.scss similarity index 100% rename from app/assets/stylesheets/_bootstrap_chosen.scss rename to app/assets/stylesheets/legacy/_bootstrap_chosen.scss diff --git a/app/assets/stylesheets/_filters.scss b/app/assets/stylesheets/legacy/_filters.scss similarity index 100% rename from app/assets/stylesheets/_filters.scss rename to app/assets/stylesheets/legacy/_filters.scss diff --git a/app/assets/stylesheets/_thin_form.scss b/app/assets/stylesheets/legacy/_thin_form.scss similarity index 100% rename from app/assets/stylesheets/_thin_form.scss rename to app/assets/stylesheets/legacy/_thin_form.scss diff --git a/app/assets/stylesheets/legacy_layout.scss b/app/assets/stylesheets/legacy_layout.scss index 16ef039f7..9ec297016 100644 --- a/app/assets/stylesheets/legacy_layout.scss +++ b/app/assets/stylesheets/legacy_layout.scss @@ -1,7 +1,7 @@ @import "govuk_admin_template"; @import "chosen"; -@import "bootstrap_chosen"; -@import "filters"; -@import "admin"; -@import "thin_form"; +@import "legacy/bootstrap_chosen"; +@import "legacy/filters"; +@import "legacy/admin"; +@import "legacy/thin_form";