travis-web/assets/scripts/app/helpers/travis-field.coffee
2015-01-19 15:51:25 +01:00

24 lines
510 B
CoffeeScript

notEmpty = Ember.computed.notEmpty
FormFieldRowView = Ember.View.extend
invalid: 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