// Generated by CoffeeScript 1.4.0
(function() {
  var __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; };

  window.Controls.main__page = (function(_super) {

    __extends(main__page, _super);

    function main__page() {
      return main__page.__super__.constructor.apply(this, arguments);
    }

    main__page.prototype.createDom = function() {
      var _this = this;
      this.dom = $("<div class=\"control container main-page\"> \n    <div class=\"content-wr\">\n        <!--div class=\"feedback\">\n            <a class=\"activate\">Leave Feedback</a>\n            <div class=\"box\">\n                <label>Email (optional)</label>\n                <br/>\n                <input class=\"control textbox\" />\n                <br/>\n                <label>Text</label>\n                <br/>\n                <textarea class=\"control textbox\"></textarea>\n                <br/>\n                <a href=\"#\" class=\"control button style-normal\">Submit</a>\n            </div>\n        </div-->\n\n        <div class=\"content\">\n            <div class=\"--child-container\"></div>\n        </div>\n    </div>\n</div>");
      this.childContainer = this.dom.find('.--child-container');
      this.feedback = this.dom.find('.feedback');
      this.feedback.find('.box').hide();
      this.feedback.find('.activate').click(function() {
        return _this.feedback.find('.box').toggle();
      });
      return this.feedback.find('.box a').click(function() {
        _this.feedback.find('.box').hide();
        return _this.event('feedback', {
          email: _this.feedback.find('input').val(),
          text: _this.feedback.find('textarea').val()
        });
      });
    };

    return main__page;

  })(window.Control);

  window.Controls.main__sections_tab = (function(_super) {

    __extends(main__sections_tab, _super);

    function main__sections_tab() {
      return main__sections_tab.__super__.constructor.apply(this, arguments);
    }

    main__sections_tab.prototype.createDom = function() {
      return this.dom = $$("<a href=\"#\" class=\"tab " + (this.properties.active ? 'active' : '') + "\">\n    <i class=\"icon-" + this.properties.icon + "\"></i>&nbsp;" + this.properties.title + "\n</a>");
    };

    return main__sections_tab;

  })(window.Control);

  window.Controls.main__sections_category = (function(_super) {

    __extends(main__sections_category, _super);

    function main__sections_category() {
      return main__sections_category.__super__.constructor.apply(this, arguments);
    }

    main__sections_category.prototype.createDom = function() {
      this.dom = $("<div class=\"control container main-sections-category\"> \n    <div>" + this.properties.name + "</div>\n    <div class=\"content\">\n        <div class=\"--child-container\"></div>\n    </div>\n</div>");
      return this.childContainer = this.dom.find('.--child-container');
    };

    return main__sections_category;

  })(window.Control);

  window.Controls.main__sections_root = (function(_super) {

    __extends(main__sections_root, _super);

    function main__sections_root() {
      return main__sections_root.__super__.constructor.apply(this, arguments);
    }

    main__sections_root.prototype.createDom = function() {
      this.dom = $("<div class=\"control container main-sections-root\">\n    <div class=\"sidebar\">\n        <div class=\"--tabs-container\"></div>\n    </div>\n    <div class=\"main\">\n        <div class=\"--child-container\"></div>\n    </div>\n</div>");
      this.tabsContainer = this.dom.find('.--tabs-container');
      this.childContainer = this.dom.find('.--child-container');
      return this.categories = {};
    };

    main__sections_root.prototype.append = function(child) {
      var cat, tab,
        _this = this;
      if (!this.categories[child.properties.category]) {
        cat = new Controls.main__sections_category(this.ui, {
          name: child.properties.category
        });
        this.categories[child.properties.category] = cat;
        this.tabsContainer.append(cat.dom);
      }
      tab = new Controls.main__sections_tab(this.ui, $.extend(child.properties, {
        visible: true
      }));
      $(tab.dom).click(function(e) {
        _this.event('switch', {
          uid: child.uid
        });
        return e.preventDefault();
      });
      this.categories[child.properties.category].append(tab);
      return main__sections_root.__super__.append.call(this, child);
    };

    return main__sections_root;

  })(window.Control);

  window.Controls.main__section = (function(_super) {

    __extends(main__section, _super);

    function main__section() {
      return main__section.__super__.constructor.apply(this, arguments);
    }

    main__section.prototype.createDom = function() {
      this.dom = $("<div class=\"control container section " + (this.properties.active ? 'active' : '') + " " + (this.properties.plain ? 'plain' : 'normal') + "\"\">\n    <div class=\"--child-container\"></div>\n</div>");
      return this.childContainer = this.dom.find('.--child-container');
    };

    return main__section;

  })(window.Control);

  window.Controls.body = (function(_super) {

    __extends(body, _super);

    function body() {
      return body.__super__.constructor.apply(this, arguments);
    }

    body.prototype.createDom = function() {
      this.dom = $$("<div class=\"control container section-body\">\n</div>");
      return this.childContainer = this.dom;
    };

    return body;

  })(window.Control);

}).call(this);
