Emails for contacts without postal addresses do not float

This was causing issues where the comment text would display oddly
next to the email address, and caused additional issues in IE.
Simplify ministerial appointment select text

There were inconsistencies between the way previous and current roles
were being displayed, e.g:

"The Rt Hon David Cameron MP, Prime Minister, in Cabinet Office and
Prime Minister's Office, 10 Downing Street"

and

"Tony Blair, as Prime Minister (02 May 1997 to 27 June 2007), in Cabinet
Office and Prime Minister's Office, 10 Downing Street"

This change gets rid of the superfluous "as" and "in" such that they now
read:

"The Rt Hon David Cameron MP, Prime Minister, Cabinet Office and
Prime Minister's Office, 10 Downing Street"

and

"Tony Blair, Prime Minister (02 May 1997 to 27 June 2007), Cabinet
Office and Prime Minister's Office, 10 Downing Street"
Cache ministerial role tagging

This adds caching to the ministerial roles select on edition forms.
Things of note:

The select field lists all role appointments for ministerial roles (past
and present) and includes the role holders name, the role name, the
dates they held the role if it was in the past, and the organisations
they belong to in the option text. This creates quite a dependency graph
for generating a cache digest that will correctly invalidate. This is
handled with after_update callbacks on the MinisterialRole and Person
models that touch the :updated_at timestamp on their role appointments.
This means that any changes in a person's organisations won't be
instantly reflected in the selects, but given that this information is
not central to tagging to a ministerial role appointment, this seems
like a reasonable compromise.
Cache speech delivery tagging

This is one of the main culprits for the slow loading of the speech
forms. Slight tweaks were made to the cache digest calculations for
ministerial role appointments to scope it to just ministerial roles to
distinguish it from the digest for all role appointments.
Detailed guides factory generates unique titles

Makes comparing editions based on their title easier out of the box.
Cache related detailed guide fields

This should result in a big performance improvement on the detailed
guides form as loading all active detailed detailed guides to generate
this select is painfully slow.
Cache related statistical data set fields

Only used on publications, but still a fairly slow select to generate.
Use edition documents to generate cache digests

Using editions to generate the cache digests is incredibly inefficient
because there will be multiple editions per-document. By making sure
that the parent document of an edition is "touch"ed after any update, we
can use the Document to generate the cache digest much more efficiently.
Cache related worldwide priority fields
Get rid of "magic" helper method

This helper existed to get around the fact that the dynamic ActiveRecord
related_policy_ids method would not return any ids for non-persisted
records that had been assigned their related policies using the
related_policy_ids= method. By overriding the method to go through the
underlying association that links editions to policy documents, we can
ensure that we get the expected ids for both persisted and non-persisted
records.
Extract #title_with_topics method
Cache related policy field on main document forms
Use cached orgs container for speed tagging
Use cached policies container for speed tagging

This behaves slightly differently now: prior to this change, any
policies already listed as check boxes were excluded from the
supplimentary select field. This is not entirely necessary and also
makes it harder to use the cached data. Besides which, this field is
rarely used during the speed tagging process. So instead we list all
policies and make sure any that are already listed as checkboxes are not
selected to avoid them appearing twice when checked.
Correct "required" state of worldwide fields

Too many things wrong with the previous code to even mention...
Cache related world locations fields
Add index on document_type to documents table

This should speed up the queries used to generate the cache digests.
CCache related ministerial roles fields
Fix indentation
Make static content static.

This was another source of poor performance, particularly generating the
format type advice data structures. Instead of storing govspeak in
locale files and loading/parsing them on every request, we store the
static HTML either directly in the appropriate partial or as a data
structure in an appropriate place.