Remove unrequired date validation requires
DRY up SpecialistDocument validators
Validate against Js in SpecialistDocument body
Don't pollute SpecialistDocument with errors and changes

No need to pollute the SpecialistDocument here with ActiveModel methods
these shouldn't be required here and should be the responsibility of the
validators.

This does however break the importer as we don't provide 'valid?' or
'errors' methods for the importer because we do not use the
SpecialistDocumentValidator. In order to solve this we use a
NullValidator to implement sensible defaults for these.
Use validator directly

When calling valid? in preview we end up with failures due to validation
errors being lost somewhere in the validation chain. Instead use the
validator directly which allows the errors hash to bubble up the chain
correctly.
If the body is invalid, render an error instead of the preview
Use pry-debugger to provide step functionality
Use rails-esque SafeHtmlValidator

Instead of using the govuk_content_models validator begin creating a validator which only validates specific fields in a more railsy way. This validator interacts directly with Govspeak::HtmlValidator driectly and only validates the html on specific fields. It means that our validator now only depends on the Govspeak gem and allows us to remove dependencies on ActiveModel::Dirty which the current gem validator expects. This is much more flexible.

We also remove the need for an SpecialistDocumentValidator to hide away the horrible hacks around 'valid?' and means that we no longer need to try DRY up the document validators and can instead explicitly validate fields for each document type.

This validator can eventually be pulled into the govuk_content_models gem and replace the SafeHtml validator there. We will not do this as part of this set of work in order to contain the large number of changes that would be required by other Gov.uk apps in order for this to work.
Merge pull request #198 from alphagov/bug/xss-preview-issue

XSS Preview Issue fix
Add a published_at field to RenderedSpecialistDocument

To avoid updated_at being modified every time we create a new draft, we
want a new 'published_at' field which is set only upon publish.
Update republishing script to work for aaib reports and IDF's
Merge pull request #199 from alphagov/set-published-at-on-rsds

Add a published_at field to RenderedSpecialistDocument
Some notes for Scraperwiki
Complete extraction of all observers to registries

Now that a requirement has arisen to modify the manual observers, it's
time to finish off nuking the observers entirely from the wiring.

Extract Manual, Manual Document and Aaib Report observers into their own
registries and nuke the original 'catch-all' observers.
Move html rendering to erb template

Fix a bug where we were calling content_tag in the service layer. Instead allow the service to pass the document down to the controller. The controller can now decide which html to render (either the document renderer body or the error html) rather than the service making this decision.

This also means the service no longer needs access to content_tag and ActionView methods.
Merge pull request #203 from alphagov/bug/xss-preview-issue-mk2

Move html rendering to erb template
Merge pull request #202 from alphagov/extract-all-observers-to-registries

Complete extraction of all observers to registries
AbstractAttachmentsController#edit does have test converage
ManualDocumentAttachmentsController#edit is also tested
ManualDocumentsController#create also has test coverage