// Generated by CoffeeScript 1.6.2
(function() {
  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['jquery', 'marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView', 'libs/bootstrap/bootpag'], function($, Marionette, UserCollection, UserItemView, Template) {
    var UserListView, _ref;

    UserListView = (function(_super) {
      __extends(UserListView, _super);

      function UserListView() {
        this.initialize = __bind(this.initialize, this);        _ref = UserListView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      UserListView.prototype.template = _.template(Template);

      UserListView.prototype.itemView = UserItemView;

      UserListView.prototype.itemViewContainer = "tbody";

      UserListView.prototype.initialize = function() {
        var _this = this;

        console.log("UserListView: initialize");
        this.collection = new UserCollection();
        this.collection.fetch({
          data: this.options,
          success: function() {
            console.log("UserListView: Collection fetched");
            console.log(_this.collection);
            $("#page-selection").bootpag({
              total: _this.collection.page_count
            }).on("page", function(event, num) {
              return $("#content").html("Insert content");
            });
          }
        });
      };

      return UserListView;

    })(Marionette.CompositeView);
    return UserListView;
  });

}).call(this);
