travis-web/app/helpers/travis-field.coffee
2015-02-03 09:44:34 +01:00

22 lines
489 B
CoffeeScript

FormFieldRowView = Ember.View.extend
invalid: Ember.computed.notEmpty('errors.[]')
classNameBindings: ['invalid']
classNames: 'field'
fn = (name, options) ->
errors = @get('errors').for(name)
template = options.fn
delete options.fn
view = FormFieldRowView.create(
controller: this
template: template
errors: errors
name: name
classNameBindings: ['name']
)
Ember.Handlebars.helpers.view.call(this, view, options)
Travis.Handlebars.travisField = fn