define( [
    'underscore',
    'Backbone',
    'zepto',
    'text!tmpl/checkbox.html'
  ],
  function (_, $, Backbone, checkbox_tmpl) {

  var exports;
  exports = {
    CheckboxChoice: CheckboxChoice,
    ChecboxChoices: CheckboxChoices,
    CheckboxChoiceView: CheckboxChoiceView,
    CheckboxChoicesView: CheckboxChoicesView
  }

  var CheckboxChoice = Backbone.Model.extend({
    // Has attr choice_val

    initialize: function() {
      this.set('checked', true);
    }

  });

  var CheckboxChoices = Backbone.Collection.extend({

    model: CheckboxChoice,

  });

  var CheckboxChoiceView = Backbone.View.extend({
    // Represent an individual checkbox with a view.

    tagName: 'label',

    class: 'checkbox',

    tmpl: Handlebars.compile(checkbox_tmpl),

    events: {
      'click input': 'set_choice',
      'click': 'clicked',
    },

    initialize: function(options) {
      // Initialize with a choice model in the options hash.
      _.bindAll(this, 'render', 'set_choice')
      this.choice = this.options.choice;
    },

    render: function() {
      var render_content = this.tmpl({
        label: this.eq_type.get('equipment_type'),
      })
      this.$el.html(render_content);
      return this
    },

    set_choice: function(e) {
      var checked = this.$el.find('input').prop('checked');
      this.eq_type.set('checked', checked)
    },

    clicked: function(e) {
      e.stopImmediatePropagation();
    }

  });


  var CheckboxChoicesView = Backbone.View.extend({
    // Represent a collection of checkboxes as a view.

    initialize: function(options) {
      // Initialize with a CheckboxChoices collection and a ref to the
      // global_q object, and the target column.
      _.bindAll(this, 'render', 'set_filters')
      this.choices = this.options.choices;
      this.global_q = this.options.global_q;
      this.col = this.options.col;
      this.choices.on('reset', this.render);
      this.choices.on('change', this.set_filters);
    },

    render: function() {
      var $el = this.$el;
      this.choices.each(function(c) {
        var choice_view = new CheckboxChoiceView({choice: c});
        $el.append(choice_view.render().el);
      });
    },

    set_filters: function() {
      // This control is represented as an 'in' clause.
      var filtered = this.choices.where({checked: true});
      var in_list = _.map(filtered, function(c) {
        return c.get('choice_val');
      });
      this.global_q.set('w', {
        col: this.col,
        op: 'in',
        other: in_list,
      });
    }

  });

  return exports;

});


@@ -135,204 +135,8 @@
  %7B%0A%0A
-  var exports;%0A  exports = %7B%0A    CheckboxChoice: CheckboxChoice,%0A    ChecboxChoices: CheckboxChoices,%0A    CheckboxChoiceView: CheckboxChoiceView,%0A    CheckboxChoicesView: CheckboxChoicesView%0A  %7D%0A%0A
   va
@@ -2363,17 +2363,20 @@
  %7D);%0A%0A  
-r
+// R
 eturn ex
@@ -2380,16 +2380,194 @@
  exports
+.%0A  return %7B%0A    CheckboxChoice: CheckboxChoice,%0A    ChecboxChoices: CheckboxChoices,%0A    CheckboxChoiceView: CheckboxChoiceView,%0A    CheckboxChoicesView: CheckboxChoicesView%0A  %7D
 ;%0A%0A%7D);%0A%0A

Fix exports