Sha256: b57f8b6fd4fc15bff631314b034d7e8fe6153d98518bb30a3f47514b8714163f

Contents?: true

Size: 562 Bytes

Versions: 6

Compression:

Stored size: 562 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()
    
    @options.model.save(null,
      success:(model) =>
        @options.model = model
        window.location.hash = "/#{@options.model.id}"
    )
    
  render: ->
    $(this.el).html(this.template(@options.model.toJSON() ))
    
    this.$("form").backboneLink(@options.model)
    
    return this

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-backbone-0.5.3 lib/generators/backbone/scaffold/templates/views/edit_view.coffee
rails-backbone-0.5.2 lib/generators/backbone/scaffold/templates/views/edit_view.coffee
rails-backbone-0.5.1 lib/generators/backbone/scaffold/templates/views/edit_view.coffee
rails-backbone-0.5.0 lib/generators/backbone/scaffold/templates/views/edit_view.coffee
rails-backbone-0.2.0 lib/generators/backbone/scaffold/templates/views/edit_view.coffee
rails-backbone-0.1.2 lib/generators/backbone/scaffold/templates/views/edit_view.coffee