     afterRender: ->
         # Cache jQuery selectors.
         @$container   = @$ '.popover-content-wrapper'
-        @addButton    = @$ '.btn.add'
+        @$addButton    = @$ '.btn.add'
         @removeButton = @$ '.remove'
         @spinner = @$ '.remove-spinner'
         @duplicateButton = @$ '.duplicate'

                error: ->
                    alert 'server error occured'
                complete: =>
                    @addButton.spin false
                    @addButton.html @getButtonText()
                    @addButton.children().show()
                    @popover.selfclose(false)

    handleError: (error) ->


    onAddClicked: ->
        return if @$('.btn.add').hasClass 'disabled'
        spinner = '<img src="img/spinner.svg" alt="spinner" />'
        @$addButton.empty()
        @$addButton.append spinner

        errors = @model.validate @model.attributes
        if errors
            @$addButton.html @getButtonText()

            @$('.alert').remove()
            @$('input').css 'border-color', ''
            @handleError err for err in errors
