Publishes HMRC contact information on GOV.UK
Ruby HTML Other
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app Fix linting errors relating to format strings May 22, 2018
bin Suggested changes from `rails app:upgrade` May 2, 2017
config Remove no-op configuration option Apr 16, 2018
db Use standard jenkins buildProject Nov 3, 2017
lib Run govuk-lint-ruby -a app lib spec May 22, 2018
log Blank Rails 4.0 app Aug 13, 2013
public
spec Fix linting review about ambiguous blocks May 22, 2018
vendor/assets
.gitignore
.rspec Install rspec Aug 13, 2013
.rubocop.yml
.ruby-version Bump to ruby-2.5.1 May 29, 2018
.travis.yml Rename application from HmrcContacts to Contacts Sep 13, 2013
Dockerfile Bump to ruby-2.5.1 May 29, 2018
Gemfile Bump govuk_frontend_toolkit from 7.5.0 to 7.6.0 Jul 19, 2018
Gemfile.lock
Jenkinsfile Disable diff linting for Ruby May 22, 2018
LICENCE Correct attribution of licence Mar 11, 2015
Procfile Run app through procfile Feb 7, 2018
README.md Remove publishing to Rummager Oct 26, 2017
Rakefile Update to ci_reporter_rspec gem Sep 2, 2016
config.ru Upgrade to rails 4.2.7.1 Aug 12, 2016
startup.sh

README.md

Contacts app

This app publishes contact information for a given organisation to GOV.UK. It replaces the HMRC contact us application and although it works for any organisation, only HMRC currently uses it.

Live examples

finder-frontend displays the index page for an organisation's contacts:

government-frontend displays the contacts themselves, fetching them from content store:

Technical documentation

This is a Ruby on Rails application that provides a private admin UI for signon users with permission to allow them to manage the contacts for their organisation.

The app has its own database (MySQL), which is used by the admin UI. This is in contrast to the separate government-frontend app which reads contacts from the content-store. The admin UI part of this app handles publishing the contacts to the publishing-api so that they are present for finder-frontend and government-frontend to read.

Dependencies

  • Ruby 2.3.0
  • MySQL
  • whitehall
    1. to access the organisations API and maintain parity with the organisations managed in whitehall.
    2. to access the world locations API to provide the correct list of countries for the country dropdown in the address form
  • signon - for managing user authentication
  • content-store - for doing some command-line based tasks to withdraw and redirect a contact

Running the application

./startup.sh

This runs bundle install to install dependencies and runs the app on port 3051. When using the GOV.UK development VM it will be available at http://contacts-admin.dev.gov.uk/admin.

By default, this application uses the GOV.UK preview environment for assets. To run against a local version of static, you need to set STATIC_DEV to "http://static.dev.gov.uk".

Running the test suite

bundle exec rake

The tests in this project rely upon govuk-content-schemas. By default these should be in the parent directory, otherwise you can specify their location with the GOVUK_CONTENT_SCHEMAS_PATH environment variable.

Tasks

Rake tasks can be found in the standard location: lib/tasks. The implementation of many of these can be found in app/tasks and app/interactors so they can also be run from the console.

Database setup

The best way to get a database with good seed data is to use a dump from preview; alternatively you can load the database schema and use the old initial seed data:

bundle exec rake db:schema:load
bundle exec rake db:seed
bundle exec rake contacts:import_hmrc DATA_FILE=db/contact-records.csv

Redirecting removed contacts

The Web UI of the app issues a “gone” item to the publishing api when a contact is deleted. Sometimes the correct thing to do is to issue a “redirect” instead. There is no web UI for this but there are two rake tasks to achieve this depending on the state of the contact to be redirected.

For contacts that still exist

The rake task is contacts:remove_with_redirect, and is invoked as follows:

$ cd /var/apps/contacts
$ sudo -u deploy govuk_setenv contacts bundle exec rake contacts:remove_with_redirect[contact-to-remove-slug,path-to-redirect-to]

For contacts that have been removed already

The rake task is contacts:replace_gone_with_redirect, and is invoked as follows:

$ cd /var/apps/contacts
$ sudo -u deploy govuk_setenv contacts bundle exec rake contacts:replace_gone_with_redirect[removed-contact-slug,organisation-slug,path-to-redirect-to]

This will fail if any of the following are true

  1. removed-contact-slug references a contact object in the Contacts Admin database
  2. the path constructed by removed-contact-slug and organisation-slug does not refer to a “gone” item in content store

Licence

MIT License