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

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

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

  BaseMigrationNodeTagGroups.prototype.getDisplayText = function() {
    return $$("base.migration.node.tag.text");
  };

  BaseMigrationNodeTagGroups.prototype.getActionFields = function() {
    var fields;
    fields = BaseMigrationNodeTagGroup.prototype.getActionFields.call(this);
    fields[0] = {
      type: CUI.Output,
      form: {
        label: $$("base.migration.node.tag_groups.text")
      },
      text: $$("base.migration.node.tag_groups.all.text")
    };
    return fields;
  };

  BaseMigrationNodeTagGroups.prototype.migrate = function(ev, action_data) {
    var c, i, len, new_target, ref, target;
    target = CUI.util.copyObject(this.getMigration().getBaseData().tags, true);
    console.debug("migrate all tag groups", ev, action_data);
    new_target = [];
    ref = this.children;
    for (i = 0, len = ref.length; i < len; i++) {
      c = ref[i];
      c.migrateTagGroup(target, action_data);
    }
    if (ev.hasModifierKey()) {
      console.debug("migrate TagGroups:", CUI.util.dump(target), target);
      return CUI.resolvedPromise();
    }
    return BaseMigrationNodeTagGroup.prototype.saveTags.call(this, target);
  };

  BaseMigrationNodeTagGroups.prototype.checkMigrateButton = function() {
    return this.__migrateBtn.enable();
  };

  return BaseMigrationNodeTagGroups;

})(BaseMigrationNodeObjecttypes);
