Sha256: 4e55631691cde921114ccce0e4e9fe549a21e3002d96510796a72e70b0e56283

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

<%= user_view_namespace %> ||= {}

class <%= user_view_namespace %>.RecoveryView extends Backbone.View
  template: JST["<%= user_jst 'recover_password' %>"]

  events:
    "submit #new-user-password": "save"

  constructor: (options) ->
    super(options)
    @model = new <%= js_user_model_namespace %>Recovery

    @model.bind("change:errors", () =>
      this.render()
    )

    @model.bind("error", (model, xhr, options) =>
      form_errors 'There was a problem recovering your password', xhr
    )

  save: (e) ->
    e.preventDefault()
    e.stopPropagation()

    @model.unset("errors")

    @model.save(@model.attributes,
      success: (user_recovery, response, options) =>
        @model = user_recovery
        window.location.hash = "/"
    )

  render: ->
    @$el.html(@template(@model.toJSON() ))

    this.$("form").backboneLink(@model)

    return this

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pbw-0.0.10 lib/generators/pbw/templates/views/recovery_view.coffee