Sha256: 8f542b04d0c1f6eb0a66bccdc03abe2af085756be2acdfcc96176578cf2cf6b4

Contents?: true

Size: 1.67 KB

Versions: 27

Compression:

Stored size: 1.67 KB

Contents

# GOV.UK Navigation Helpers

This is a gem to share code between GOV.UK frontends.

## Nomenclature

- **content item**: An object returned by the content store

## Technical documentation

These helpers format data from the [content store](https://github.com/alphagov/content-store) for use with [GOV.UK Components](http://govuk-component-guide.herokuapp.com/about).

### Installation

Add this line to your application's Gemfile:

```ruby
gem 'govuk_navigation_helpers', '~> VERSION'
```

And then execute:

    $ bundle

### Configuration

This gem allows the configuration of:

- an error handler class (e.g. `Airbrake`), that implements a `notify` method
  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
  should implement `increment(metric)` and `time(metric, &block)`.

### Usage

Get the JSON representation of a page and initialise the helper:

```ruby
def some_controller_method
  content_item = Services.content_store.content_item("/register-to-vote")
  @navigation = GovukNavigationHelpers::NavigationHelper.new(content_item)
end
```

Render the component:

```ruby
<%= render partial: 'govuk_component/breadcrumbs', locals: @navigation.breadcrumbs %>
```

```ruby
<%= render partial: 'govuk_component/related_items', locals: @navigation.related_items %>
```

### Running the test suite

`bundle exec rake`

### Documentation

See [RubyDoc](http://www.rubydoc.info/gems/govuk_navigation_helpers) for some limited documentation.

To run a Yard server locally to preview documentation, run:

    $ bundle exec yard server --reload

## Licence

[MIT License](LICENCE.txt)

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
govuk_navigation_helpers-9.0.0 README.md
govuk_navigation_helpers-8.2.2 README.md
govuk_navigation_helpers-8.2.1 README.md
govuk_navigation_helpers-8.2.0 README.md
govuk_navigation_helpers-8.1.1 README.md
govuk_navigation_helpers-8.1.0 README.md
govuk_navigation_helpers-8.0.0 README.md
govuk_navigation_helpers-7.5.1 README.md
govuk_navigation_helpers-7.5.0 README.md
govuk_navigation_helpers-7.4.0 README.md
govuk_navigation_helpers-7.3.0 README.md
govuk_navigation_helpers-7.2.0 README.md
govuk_navigation_helpers-7.1.0 README.md
govuk_navigation_helpers-7.0.0 README.md
govuk_navigation_helpers-6.3.0 README.md
govuk_navigation_helpers-6.2.0 README.md
govuk_navigation_helpers-6.1.0 README.md
govuk_navigation_helpers-6.0.2 README.md
govuk_navigation_helpers-6.0.1 README.md
govuk_navigation_helpers-6.0.0 README.md