From 0e8ebd6ed96873cbdb016c11b3f1f270b2e18923 Mon Sep 17 00:00:00 2001 From: Jon Kirwan <87758239+jon-kirwan@users.noreply.github.com> Date: Fri, 2 Dec 2022 12:07:02 +0000 Subject: [PATCH] Temp - add app component styles --- app/assets/config/manifest.js | 9 +++++---- app/assets/stylesheets/application.scss | 6 +++--- .../stylesheets/components/_result-card.scss | 2 ++ .../stylesheets/components/_result-item.scss | 2 ++ .../components/_result-sections.scss | 2 ++ app/controllers/application_controller.rb | 20 +++++++++++-------- app/views/components/_result-card.html.erb | 3 +++ app/views/components/_result-item.html.erb | 3 +++ .../components/_result-sections.html.erb | 3 +++ .../check_uk_visa/_result-card.html.erb | 3 +++ app/views/layouts/application.html.erb | 14 +------------ 11 files changed, 39 insertions(+), 28 deletions(-) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 2d9509690e4..a835e7869ac 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,9 +1,10 @@ //= link application.css //= link print.css -//= link govuk_publishing_components/components/_radio.css -//= link govuk_publishing_components/components/_date-input.css -//= link govuk_publishing_components/components/_fieldset.css -//= link govuk_publishing_components/components/_summary-list.css + +//= link components/_result-card.css +//= link components/_result-item.css +//= link components/_result-sections.css + //= link visualise.css //= link joint.css //= link application.js diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index c04e8be0e8d..5ebeac3b88e 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -26,9 +26,9 @@ $govuk-include-default-font-face: false; // @import "govuk_publishing_components/components/warning-text"; @import "components/autocomplete"; -@import "components/result-card"; -@import "components/result-item"; -@import "components/result-sections"; +// @import "components/result-card"; +// @import "components/result-item"; +// @import "components/result-sections"; // @import "smart_answers"; .desktop-min-height { diff --git a/app/assets/stylesheets/components/_result-card.scss b/app/assets/stylesheets/components/_result-card.scss index b9f72d8b354..c46fd9826cc 100644 --- a/app/assets/stylesheets/components/_result-card.scss +++ b/app/assets/stylesheets/components/_result-card.scss @@ -1,3 +1,5 @@ +@import "govuk_publishing_components/govuk_frontend_support"; + .app-c-result-card { position: relative; padding: govuk-spacing(5) govuk-spacing(4); diff --git a/app/assets/stylesheets/components/_result-item.scss b/app/assets/stylesheets/components/_result-item.scss index 4be18c2148e..7563a919f51 100644 --- a/app/assets/stylesheets/components/_result-item.scss +++ b/app/assets/stylesheets/components/_result-item.scss @@ -1,3 +1,5 @@ +@import "govuk_publishing_components/govuk_frontend_support"; + .app-c-result-item { @include govuk-font($size: 19); padding-top: govuk-spacing(6); diff --git a/app/assets/stylesheets/components/_result-sections.scss b/app/assets/stylesheets/components/_result-sections.scss index 7671806232c..330bbb8e9f8 100644 --- a/app/assets/stylesheets/components/_result-sections.scss +++ b/app/assets/stylesheets/components/_result-sections.scss @@ -1,3 +1,5 @@ +@import "govuk_publishing_components/govuk_frontend_support"; + .app-c-result-sections { margin-bottom: govuk-spacing(7) * 2; } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f830d3a98ca..887e3b4afd4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,14 +1,6 @@ class ApplicationController < ActionController::Base include Slimmer::Template - before_action do - begin - @individual_stylesheets = GovukPublishingComponents::AppHelpers::AssetHelper.new - rescue NameError - logger.warn("The version of the components gem being used doesn't support individual asset loading.") - end - end - rescue_from GdsApi::TimedOutException, with: :error_503 rescue_from GdsApi::HTTPForbidden, with: :error_403 rescue_from ActionController::UnknownFormat, with: :error_404 @@ -23,6 +15,18 @@ class ApplicationController < ActionController::Base slimmer_template :gem_layout + before_action do + puts "HERE" + begin + puts "HERE 2" + @individual_stylesheets = GovukPublishingComponents::AppHelpers::AssetHelper.new + puts @individual_stylesheets + puts "HERE 3" + rescue NameError + logger.warn("The version of the components gem being used doesn't support individual asset loading.") + end + end + protected def debug? diff --git a/app/views/components/_result-card.html.erb b/app/views/components/_result-card.html.erb index a6923b590df..b9e7241418e 100644 --- a/app/views/components/_result-card.html.erb +++ b/app/views/components/_result-card.html.erb @@ -1,3 +1,6 @@ +<%= debug(@individual_stylesheets) %> +<% @individual_stylesheets.add_component("result-card") if @individual_stylesheets %> + <% title ||= nil description ||= nil diff --git a/app/views/components/_result-item.html.erb b/app/views/components/_result-item.html.erb index e2a3d5c7590..d57e7adff5c 100644 --- a/app/views/components/_result-item.html.erb +++ b/app/views/components/_result-item.html.erb @@ -1,3 +1,6 @@ +<%= debug(@individual_stylesheets) %> +<% @individual_stylesheets.add_component("result-item") if @individual_stylesheets %> + <% title ||= nil url ||= nil diff --git a/app/views/components/_result-sections.html.erb b/app/views/components/_result-sections.html.erb index 8cabcaa7472..c60ccfda91b 100644 --- a/app/views/components/_result-sections.html.erb +++ b/app/views/components/_result-sections.html.erb @@ -1,3 +1,6 @@ +<%= debug(@individual_stylesheets) %> +<% @individual_stylesheets.add_component("result-sections") if @individual_stylesheets %> + <% highlighted ||= true group_index ||= 1 diff --git a/app/views/components/check_uk_visa/_result-card.html.erb b/app/views/components/check_uk_visa/_result-card.html.erb index dc5d3a0f061..5e4ef0e7841 100644 --- a/app/views/components/check_uk_visa/_result-card.html.erb +++ b/app/views/components/check_uk_visa/_result-card.html.erb @@ -1,3 +1,6 @@ +<%= debug(@individual_stylesheets) %> +<% @individual_stylesheets.add_component("result-card") if @individual_stylesheets %> + <% type ||= nil title ||= nil diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index aefa9561024..78a51af1980 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -43,24 +43,12 @@ <% end %> - <% - # puts "1" - # puts @individual_stylesheets.inspect - # if defined? @individual_stylesheets - # puts "2" - # @individual_stylesheets.get_stylesheets.map do |component| - # puts "component".upcase! - # puts component - # end - # end - %> <%= if defined? @individual_stylesheets puts "@individual_stylesheets".upcase! puts @individual_stylesheets.inspect list_of_stylesheets = @individual_stylesheets.get_stylesheets.map do | component | - puts "component" - puts component + puts "component:".upcase! + component stylesheet_link_tag(component, integrity: false) end raw(list_of_stylesheets.join(""))