Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created November 16, 2012 21:24
Show Gist options
  • Save groovecoder/4091055 to your computer and use it in GitHub Desktop.
Save groovecoder/4091055 to your computer and use it in GitHub Desktop.
Note.AddView = Backbone.View.extend({
el: '#addNote',
noteList: null,
events: {
"click button#btnAdd": "actionSubmit"
},
initialize: function(options){
this.geo = options.geo;
this.noteList = options.noteList;
this.coordsView = new Geo.CoordsView({model: this.geo});
_.bindAll(this, 'render');
},
render: function(noteList){
this.coordsView.render();
},
actionSubmit: function() {
// Variables
var addNote = $('#addNote'),
text = $('#noteText', addNote).val(),
position = this.geo.get("currentPosition");
// Add note
note = new Note.Model({
text: text,
position: position
});
this.noteList.add(note);
// Redirect
window.location.hash = '';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment