Merge pull request #12 from ministryofjustice/use-refresh-with-elasticsearch

Use elasticsearch#refresh instead of sleep
Add community model

- db migration
- model spec
- models
Add ability to select communities
Support searching by community

Note that we explicitly add an after_commit callback to do a full
re-index of person. This is because the normal update_document method
invoked by the ElasticSearch::Model::Callbacks will only send an index
update message if there are changes reported by ActiveModel::Dirty.

Changes to community do not appear so we need this hack to force the
full re-indexing.

I attempted to add a unit test for this, but it proved tricky because
the update is triggered on commit rather than save and the specs run
inside a transaction (using transactional fixtures).

This is the spec which I tried:

```
let(:community2) { create(:community, name: "Fishmongers") }

it 'updates to community appear immediately in search index' do
  expect(search_for(community.name)).to include(alice)

  alice.community = community2
  alice.save!

  Peoplefinder::Person.__elasticsearch__.client.indices.refresh
  expect(search_for(community.name).map(&:name)).not_to include(alice.name)
  expect(search_for(community2.name)).to include(alice)
end
```

I felt that it wasn't worth changing the hook to after_save as that
semantically does something slightly different, and since we are
considering switching to use postgres full text search anyway I felt
that this didn't matter too much.
Community name links to search
Add communities feature flag
Remove spurious save_and_open_page
Rubocop style
Allow methods of up to 12 lines

I agree that 10 lines is a good guideline but it seems a bit much to
strictly enforce it, and in this particular case I don't think it would
aid comprehensibility of the method to refactor it to move part of the
literal data structure describing search parameters out somewhere else
just to satisfy the 10 line limit.
Updating schema to include taggings table
Merge pull request #13 from ministryofjustice/add-community-field

Add community field
A helper method to enable html page titles
Accessible page titles for error pages
Accessible page titles for profile pages
Accessible page titles for team pages
Accessible page title for search results page
Accessible page titles for login pages
Make heading levels sequential on login pages

- accessible pages need h1 h2 h3 to be sequential

- uses a fake '.h3' class to display an h2 as an 
h3
Add role='alert' to the login error message
Use h1 on token created page