Skip to content
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

Merged
merged 2 commits into from Mar 14, 2017

Conversation

boffbowsh
Copy link
Contributor

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 to app/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:
screen shot 2017-03-13 at 16 58 15

@boffbowsh boffbowsh requested review from timblair and fofr March 13, 2017 17:23
<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&nbsp;information</a></p>
Copy link
Contributor

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

Copy link
Contributor Author

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))
Copy link
Contributor

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
@boffbowsh boffbowsh merged commit bf74dd4 into master Mar 14, 2017
@boffbowsh boffbowsh deleted the global-banner branch March 14, 2017 09:05
boffbowsh added a commit that referenced this pull request May 25, 2017
This reverts commit bf74dd4, reversing
changes made to 41e4be3.
boffbowsh added a commit that referenced this pull request May 25, 2017
Revert "Merge pull request #1171 from alphagov/global-banner"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants