Skip to content

DEFRA/defra-ruby-template

Repository files navigation

Defra Ruby Template

Build Status security Gem Version Licence

About

Adds a GOV.UK-ready layout template and the govuk_frontend assets to a Rails application.

Installation

Add this line to the application's Gemfile:

gem 'defra-ruby-template'

And then execute:

$ bundle

Usage

The Rails application will need to have SCSS enabled (e.g. sass-rails).

This gem includes the defra_ruby_template layout, and can be included in a Rails project by adding the following to the default layout (e.g. application.html.erb)


<% content_for :page_title do %>
    Page title or defaults to the i18n `global_proposition_header`
<% end %>

<% content_for :head do %>
  Stylesheets, Analytics, etc.
<% end %>

<% content_for :header_content do %>
 Application name and top-level links
<% end %>

<% content_for :phase_banner do %>
  Phase banner, e.g Alpha, Beta, etc
<% end %>

<% content_for :back_link do %>
    Link to go back
<% end %>

<% content_for :footer do %>
  Application specific footer links
<% end %>

<%= render template: "layouts/defra_ruby_template" %>

Updating the govuk-frontend

To update to the latest govuk-frontend files:

$ npm install govuk-frontend --save
$ rake

Then update the DefraRubyTemplate::Version so that it matches the govuk-frontend version.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DEFRA/defra-ruby-template.