// Generated by CoffeeScript 1.12.7
var ExampleDetailSidebarPlugin,
  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;

ExampleDetailSidebarPlugin = (function(superClass) {
  extend(ExampleDetailSidebarPlugin, superClass);

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

  ExampleDetailSidebarPlugin.prototype.prefName = function() {
    return "example_detail_sidebar_plugin";
  };

  ExampleDetailSidebarPlugin.prototype.getPane = function() {
    return "top";
  };

  ExampleDetailSidebarPlugin.prototype.getButtonLocaKey = function() {
    return "example.detail.sidebar.plugin.button";
  };

  ExampleDetailSidebarPlugin.prototype.render = function() {
    return console.info("ExampleDetailSidebarPlugin.render():", this._detailSidebar);
  };

  ExampleDetailSidebarPlugin.prototype.renderObject = function() {
    return console.info("ExampleDetailSidebarPlugin.renderObject():", this._detailSidebar, this.__currentObject);
  };

  ExampleDetailSidebarPlugin.prototype.isAvailable = function() {
    return true;
  };

  ExampleDetailSidebarPlugin.prototype.hideDetail = function() {
    return this._detailSidebar.mainPane.empty("top");
  };

  ExampleDetailSidebarPlugin.prototype.renderObjectDetailSidebar = function() {
    return this.getButton().addClass("ez5-example-detail-sidebar-plugin-btn-red");
  };

  ExampleDetailSidebarPlugin.prototype.showDetail = function() {
    var field, i, len, obj, od, ref, ref1;
    obj = this._detailSidebar.object;
    ref = obj.mask.getFields("all");
    for (i = 0, len = ref.length; i < len; i++) {
      field = ref[i];
      console.debug("Field:", field.fullName(), field, "custom settings:", (ref1 = field.FieldSchema) != null ? ref1.custom_settings : void 0);
    }
    od = new CUI.ObjectDumper({
      object: obj.getData()
    });
    this._detailSidebar.mainPane.replace([
      new CUI.Label({
        text: "More info dumped to console!"
      }), od
    ], "top");
    return this;
  };

  return ExampleDetailSidebarPlugin;

})(DetailSidebarPlugin);

ez5.session_ready((function(_this) {
  return function() {
    return DetailSidebar.plugins.registerPlugin(ExampleDetailSidebarPlugin);
  };
})(this));
