/public/js/views/post_status.js

http://github.com/bkeepers/monologue · JavaScript · 21 lines · 12 code · 1 blank · 8 comment · 0 complexity · 7c66781f053f7d361e1ddf8b002d6218 MD5 · raw file

  1. // View to manage posting a new status.
  2. //
  3. // Responsibility:
  4. // Create a status from user input
  5. //
  6. // Dependencies:
  7. // * el - A form element with a textarea
  8. // * collection - the collection that the status will be created in
  9. Monologue.View.PostStatus = Backbone.View.extend({
  10. events: {
  11. "submit": "submit"
  12. },
  13. submit: function(e) {
  14. e.preventDefault();
  15. var $input = this.$el.find('textarea');
  16. this.collection.create({text: $input.val()});
  17. $input.val('');
  18. return false;
  19. }
  20. });