Maildog.Views.LabelList = Backbone.CompositeView.extend({
  template: JST['labelList'],

  events: {
    "click #create-new-label-button": "showTextBox"
  },

  initialize: function() {
    this.collection = new Maildog.Collections.Labels();
    this.collection.fetch({ reset: true });
    this.listenTo(this.collection, "reset", this.render);
    this.listenTo(
      this.collection, "add", this.addSubviewForLabel.bind(this)
    );
  },

  render: function() {
    this.$el.html(this.template());
    this.collection.forEach(this.addSubviewForLabel.bind(this));
    return this;
  },

  showTextBox: function(e) {
    e.preventDefault();
    this.$('#create-new-label-button').prop('disabled', true);
    this.$('.new-label-input').removeClass('invisible').focus();

    window.setTimeout(function() {
      $('html').click(function(e) {
        this.newLabel(e, { text: this.$('input').val() });
      }.bind(this));
    }.bind(this), 0);
  },

  newLabel: function(e, options) {
    if ($(e.target).hasClass("new-label-input")) { return; }
    $('html').off('click');
    if (options.text) {
      label = new Maildog.Models.Label({ name: options.text })
      label.save({}, {
        success: function(model) {
          this.collection.add(model)
        }.bind(this)
      });
      this.$('input').val("");
    }
    this.$('input').addClass('invisible');
    this.$('#create-new-label-button').prop('disabled', false);
  },

  addSubviewForLabel: function(label, prepend) {
    var subview = new Maildog.Views.LabelListItem({
      collection: this.collection,
      model: label
    });
    this.addSubview(".label-list", subview);
  }
});

@@ -910,24 +910,184 @@
 ind(this));%0A
+%0A      $('html').keydown(function(e) %7B%0A        if (e.which !== 13) %7B return; %7D%0A        this.newLabel(e, %7B text: this.$('input').val() %7D);%0A      %7D.bind(this));%0A%0A
     %7D.bind(t
@@ -1145,16 +1145,34 @@
     if (
+e.which !== 13 && 
 $(e.targ
@@ -1240,24 +1240,55 @@
 f('click');%0A
+    $('html').off('keydown');%0A%0A
     if (opti

add enter key support to create new labels input