GOV.UK Navigation Helpers
This is a gem to share code between GOV.UK frontends.
** It should not be used anymore ***
This gem was a temporary solution to the problem of sharing code used to generate the input to components. Since the components can now be built into the govuk_publishing_components gem, it is no longer necessary.
- content item: An object returned by the content store
Add this line to your application's Gemfile:
gem 'govuk_navigation_helpers', '~> VERSION'
And then execute:
This gem allows the configuration of:
- an error handler class (e.g.
Airbrake), that implements a
notifymethod which takes an exception object (by default, it prints the exception to stdout when not configured);
- a statsd client - when not configured, it does not do anything. This client
Get the JSON representation of a page and initialise the helper:
def some_controller_method content_item = Services.content_store.content_item("/register-to-vote") @navigation = GovukNavigationHelpers::NavigationHelper.new(content_item) end
Render the component:
<%= render partial: 'govuk_component/breadcrumbs', locals: @navigation.breadcrumbs %>
<%= render partial: 'govuk_component/related_items', locals: @navigation.related_items %>
Running the test suite
bundle exec rake
See RubyDoc for some limited documentation.
To run a Yard server locally to preview documentation, run:
$ bundle exec yard server --reload