Sha256: 5053a5d4a5d51f672e568516bd2dbbe1f249ad61879268ffbd5898ca8f79ee37

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

class App.Validators.Confirmation extends App.Validators.Base
  constructor: -> super

  validate: ->
    @properAttr = "#{@attr}Confirmation"
    properVal = @obj[@properAttr]
    return true if @val? and properVal? and @val is properVal
    this._addErrorMessage()
    false

  _addErrorMessage: ->
    console.log "TODO: implement I18n"
    # TODO: extend underscore with mixin
    attrName = @attr.charAt(0).toUpperCase() + @attr.slice(1)
    message = "doesn't match #{attrName}"
    @obj.addErrorMessage message, for: @properAttr

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loco-rails-0.0.1 lib/assets/javascripts/loco/validators/confirmation.coffee