Skip to content

Commit

Permalink
Temp - workaround for app component styles from /flows
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-kirwan committed Dec 14, 2022
1 parent 0e8ebd6 commit ff84bc7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
4 changes: 4 additions & 0 deletions app/flows/check_uk_visa_flow/outcomes/outcome_work_y.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<% text_for :stylesheets do%>
<%= %w[result_card] %>
<% end %>

<% text_for :title do %>
<%= calculator.outcome_title %>
<% end %>
Expand Down
14 changes: 7 additions & 7 deletions app/models/world_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions app/presenters/outcome_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions app/views/smart_answers/result.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<% @individual_stylesheets.add_gem_component("govspeak") %>

<% outcome = @presenter.current_node %>
<%= debug(outcome.stylesheets) %>
<%= outcome.stylesheets == '[&quot;result_card&quot;]' ? "1" : "2" %>
<% @individual_stylesheets.add_component("result-card") if outcome.stylesheets == "[&quot;result_card&quot;]" %>
<% @individual_stylesheets.add_component("meh") if outcome.stylesheets == "[&quot;result_card&quot;]" %>

<% content_for :outcome_title do %>
<% if outcome.title.present? %><%= outcome.title %><% else %>Outcome<% end %>
<% end %>
<% content_for :head do %>
<meta name="robots" content="noindex">
<% end %>

<%= debug(@individual_stylesheets) %>

<div class="govuk-grid-row">

<div
Expand Down
3 changes: 2 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ if [[ $1 == "--live" ]] ; then
GOVUK_WEBSITE_ROOT=https://www.gov.uk \
GOVUK_PROXY_STATIC_ENABLED=true \
PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.gov.uk/api} \
PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-https://assets.publishing.service.gov.uk} \
# PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-https://assets.publishing.service.gov.uk} \
PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-static.dev.gov.uk} \
bundle exec rails s -p 3010
else
echo "ERROR: other startup modes are not supported"
Expand Down

0 comments on commit ff84bc7

Please sign in to comment.