New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for displaying a banner on the GOV.UK homepage #1171
Conversation
<div id="homepage-promo-banner"> | ||
<div class="banner-message"> | ||
<p><strong>Some Title</strong> On some date something has happened. | ||
<a href="https://something.gov.uk" rel="external nofollow">More information</a></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should include the visuallyhidden
part that the global banner has so that extra context is added for accessibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for pointing that out, I'll make sure we have copy for the hidden part
|
||
def stub_template(hash) | ||
require 'action_view/testing/resolvers' | ||
@controller.view_paths.unshift(ActionView::FixtureResolver.new(hash)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done 👍
This ensures that we can deploy most of the functionality in advance and switch over the banner content in the final deploy. As we want to be able to deploy just the content, the tests need to support a partial both with and without content. To do this, we override the view path to stub templates replacement. This is borrowed from rspec-rails’ `stub_template` method https://github.com/rspec/rspec-rails/blob/e8054a1cd03044f725030fe8315952 cf3799a395/lib/rspec/rails/example/view_example_group.rb#L86-L88
0200983
to
c00fe66
Compare
Revert "Merge pull request #1171 from alphagov/global-banner"
This allows us to deploy a partial containing copy to be placed below the search bar on the GOV.UK homepage. The example at
app/views/homepage/_promo_banner_example.html.erb
should be copied toapp/views/homepage/_promo_banner.html.erb
and deployed.app/views/homepage/_promo_banner.html.erb
should be left empty if the banner is not in use.Example: