Sha256: 2269b4c5099b355597785b92391cfa7437f0166183a2d0b616e1569cc1ab110b

Contents?: true

Size: 559 Bytes

Versions: 1

Compression:

Stored size: 559 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-0.5.4 lib/generators/backbone/scaffold/templates/views/edit_view.coffee