alphagov/govuk_content_api — pull request #160 by JordanHatch (2014-02-18 16:18:43+00:00)
Title: Allow content for a tag to be grouped by format

This pull request adds new behaviour to the `/with_tag.json` endpoint in the Content API. We'd like to iterate the [specialist browse navigation](https://www.gov.uk/oil-and-gas) to group content together based on their format. In some cases, we also want to display multiple formats as part of the same group - eg. it makes sense for the `guidance` and `detailed_guide` formats to be shown together.

To do this, I've added a new presenter, called `GroupedResultSetPresenter`, which subclasses and has the same interface as the existing `ResultSetPresenter`. The new presenter is used when `group_by=format` is provided in the URL.

The new presenter uses a hard-coded list of groups and formats to combine all the artefacts in the result set into groups. For now, artefacts which have formats that are not specified in the group listing are excluded.