Sha256: 12e680c6e4ec7b9b03bfb70575d01299160357118ae7a5d489383a81da9aac64

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

<%= view_namespace %> ||= {}

class <%= view_namespace %>.EditView extends Backbone.View
  template : JST["<%= jst 'edit' %>"]

  events :
    "submit #edit-<%= singular_name %>" : "update"

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

    @model.save(null,
      success : (<%= singular_name %>) =>
        @model = <%= singular_name %>
        window.location.hash = "/#{@model.id}"
    )

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

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

    return this

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-backbone-sp-0.0.1 lib/generators/backbone/scaffold/templates/views/edit_view.coffee