Skip to content

sistephens/calendars

 
 

Repository files navigation

Calendars

Serves calendars in a clear and accessible format, along with JSON and iCal exports of the data.

Screenshots

Screenshot

Live examples

Nomenclature

  • scope: sach type of calendar (eg daylight saving, bank holidays) is known as a scope. A scope has its own view templates, JSON data source and primary route.

Technical documentation

This is a Ruby on Rails application that serves static pages based on JSON files. It does not use a database.

JSON data files are stored in lib/data/<scope>.json, with a divisions hash for separate data per region (united-kingdom, england-and-wales, scotland or northern-ireland).

Each scope's data file contains a list of divisions, containing a list of years, each with a list of events:

{
  "title": "UK bank holidays",
  "description": "UK bank holidays calendar - see UK bank holidays and public holidays for 2012 and 2013",
  "divisions": {
    "england-and-wales": {
      "title": "England and Wales",
      "2011": [{
        "title": "New Year's Day",
        "date": "02/01/2011",
        "notes": "Substitute day"
      }]
    }
  }
}

The division title attribute is optional. If this is not present the slug will be humanized and used instead.

Dependencies

  • rummager: this app indexes its pages for search via Rummager.
  • publishing-api: this app sends data to the content-store.

Additional information

Publishing to GOV.UK

  • bundle exec rake publishing_api:publish will send the calendars to the publishing-api.

Search indexing

  • bundle exec rake rummager:index will send the data to Rummager for indexing in search.

Generate bank holidays JSON

A rake task has been created to generate the bank holidays JSON for a given year. They need to be then inserted, and modified to take into account any additions/modifications made by proclamation. Run the rake task like this:

bundle exec rake bank_holidays:generate_json[2016]

Canonical sources

Running the application

When you are in Development:

bundle exec bowl calendars www

Running the test suite

bundle exec rake

Deploying a preview to Heroku

Start by creating a GitHub pull request with the changes you want to deploy.

Make a note of the pull request number and use the startup_heroku.sh script to deploy your changes to Heroku:

$ PR=<number-of-pull-request> ./startup_heroku.sh

This script will create and configure an app on Heroku, push the current branch and open the marriage-abroad Smart Answer in the browser.

Once deployed you'll need to use the standard git push mechanism to deploy your changes.

./startup_heroku.sh

Licence

MIT License

About

Serves /bank-holidays and /when-do-the-clocks-change

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 81.9%
  • HTML 8.9%
  • CSS 8.2%
  • Shell 1.0%