Simplify form error input handling

The form-input class now has the directive responsible for setting
the error classes. It watches its scope and sets the errors only
if the model is defined. This guard against undefined keeps the
error class from being set until validation passes, which is the
case when local validation succeeds, but in a digest cycle after the
server returns a failure notification this will trigger the error
class.
    
The form-validate directive is now just a controller forform-input to
register a callback to force error checking on submit.
Just me misreading. I thought it was the same class.
On Aug 18, 2014 2:28 AM, "Aron Carroll" <notifications@github.com> wrote:

> In h/static/scripts/directives.coffee:
>
> >
> > -      if field.$valid or field.$pristine
> > -        toggleClass(field, addClass: false)
> > -      else if field.$dirty
> > -        toggleClass(field, addClass: true)
> > +    toggleClass = (addClass) ->
> > +      elem.toggleClass(errorClassName, addClass)
>
> Why are we applying the class to the input too? It should be
> form-input-error or similar if we want to have one.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/hypothesis/h/pull/1405/files#r16343944>.
>