From ff84bc722441c0b9e621b5be14a1e45b8f6a7cb9 Mon Sep 17 00:00:00 2001 From: Jon Kirwan <87758239+jon-kirwan@users.noreply.github.com> Date: Wed, 14 Dec 2022 16:18:45 +0000 Subject: [PATCH] Temp - workaround for app component styles from /flows --- app/controllers/application_controller.rb | 2 +- .../check_uk_visa_flow/outcomes/outcome_work_y.erb | 4 ++++ app/models/world_location.rb | 14 +++++++------- app/presenters/outcome_presenter.rb | 4 ++++ app/views/smart_answers/result.html.erb | 7 +++++++ startup.sh | 3 ++- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 887e3b4afd4..a602386d0b8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -20,7 +20,7 @@ class ApplicationController < ActionController::Base begin puts "HERE 2" @individual_stylesheets = GovukPublishingComponents::AppHelpers::AssetHelper.new - puts @individual_stylesheets + puts @individual_stylesheets.inspect puts "HERE 3" rescue NameError logger.warn("The version of the components gem being used doesn't support individual asset loading.") diff --git a/app/flows/check_uk_visa_flow/outcomes/outcome_work_y.erb b/app/flows/check_uk_visa_flow/outcomes/outcome_work_y.erb index c7157c682ed..de93a944228 100644 --- a/app/flows/check_uk_visa_flow/outcomes/outcome_work_y.erb +++ b/app/flows/check_uk_visa_flow/outcomes/outcome_work_y.erb @@ -1,3 +1,7 @@ +<% text_for :stylesheets do%> + <%= %w[result_card] %> +<% end %> + <% text_for :title do %> <%= calculator.outcome_title %> <% end %> diff --git a/app/models/world_location.rb b/app/models/world_location.rb index a7bd557376d..7d9671154fa 100644 --- a/app/models/world_location.rb +++ b/app/models/world_location.rb @@ -15,15 +15,15 @@ def self.reset_cache def self.all cache_fetch("all") do - world_locations = GdsApi.worldwide - .world_locations - .with_subsequent_pages - .select { |r| valid_world_location_format?(r.to_hash) } - .map { |r| new(r.to_hash) } + # world_locations = GdsApi.worldwide + # .world_locations + # .with_subsequent_pages + # .select { |r| valid_world_location_format?(r.to_hash) } + # .map { |r| new(r.to_hash) } - raise NoLocationsFromWorldwideApiError if world_locations.empty? + # raise NoLocationsFromWorldwideApiError if world_locations.empty? - world_locations + world_locations = [] end end diff --git a/app/presenters/outcome_presenter.rb b/app/presenters/outcome_presenter.rb index 5bcb8de0010..6865aa23fe7 100644 --- a/app/presenters/outcome_presenter.rb +++ b/app/presenters/outcome_presenter.rb @@ -18,6 +18,10 @@ def title @renderer.content_for(:title) end + def stylesheets + @renderer.content_for(:stylesheets) + end + def description @renderer.content_for(:description) end diff --git a/app/views/smart_answers/result.html.erb b/app/views/smart_answers/result.html.erb index ab03f26cdeb..13c0fcb6b33 100644 --- a/app/views/smart_answers/result.html.erb +++ b/app/views/smart_answers/result.html.erb @@ -1,6 +1,11 @@ <% @individual_stylesheets.add_gem_component("govspeak") %> <% outcome = @presenter.current_node %> +<%= debug(outcome.stylesheets) %> +<%= outcome.stylesheets == '["result_card"]' ? "1" : "2" %> +<% @individual_stylesheets.add_component("result-card") if outcome.stylesheets == "["result_card"]" %> +<% @individual_stylesheets.add_component("meh") if outcome.stylesheets == "["result_card"]" %> + <% content_for :outcome_title do %> <% if outcome.title.present? %><%= outcome.title %><% else %>Outcome<% end %> <% end %> @@ -8,6 +13,8 @@ <% end %> +<%= debug(@individual_stylesheets) %> +