// Generated by CoffeeScript 1.12.7
var extend = 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; },
  hasProp = {}.hasOwnProperty;

ez5.ExampleUserPlugin = (function(superClass) {
  extend(ExampleUserPlugin, superClass);

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

  ExampleUserPlugin.prototype.getTabs = function(tabs) {
    tabs.push({
      name: "example",
      text: "Example",
      content: (function(_this) {
        return function() {
          var form;
          form = new CUI.Form({
            data: _this._user.data.user,
            name: "custom_data",
            fields: [
              {
                type: CUI.Input,
                name: "my_field",
                form: {
                  label: "My field",
                  hint: "Write some data! This is a hint"
                }
              }
            ]
          });
          return form.start();
        };
      })(this)
    });
  };

  ExampleUserPlugin.prototype.getSaveData = function(saveData) {
    saveData.user.custom_data.my_field = this._user.data.user.custom_data.my_field;
  };

  ExampleUserPlugin.prototype.isAllowed = function() {
    var ref;
    return (ref = this._user.data.user.type) === "easydb" || ref === "system";
  };

  return ExampleUserPlugin;

})(ez5.UserPlugin);

User.plugins.registerPlugin(ez5.ExampleUserPlugin);
