<commit_before>/**
 * We will save all the templates that any component need
 */
orion.admin.requestTemplate = function(name) {
  check(name, String);
  orion.options.init('template.' + name);
}

/**
 * Reactively returns the name of the template
 */
orion.admin.template = function(name) {
  return orion.options.get('template.' + name);
}

/**
 * Assings a template to a template request
 */
orion.admin.setTemplate = function(requestedName, templateName) {
  return orion.options.set('template.' + requestedName, templateName);
}

if (Meteor.isClient) {

  /**
   * Set helpers to a template that maybe it doensn't exists yet
   */
  orion.admin.setTemplateHelpers = function(templateName, helpers) {
    Tracker.autorun(function () {
      var template = orion.admin.template(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].helpers(helpers);
      }
    });
  }

  /**
   * Set events to a template that maybe it doensn't exists yet
   */
  orion.admin.setTemplateEvents = function(templateName, events) {
    Tracker.autorun(function () {
      var template = orion.admin.template(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].events(events);
      }
    });
  }

  /**
   * Set onRendered to a template that maybe it doensn't exists yet
   */
  orion.admin.setTemplateOnRendered = function(templateName, onRendered) {
    Tracker.autorun(function () {
      var template = orion.admin.template(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].onRendered(onRendered);
      }
    });
  }

  /**
   * Set onCreated to a template that maybe it doensn't exists yet
   */
  orion.admin.setTemplateOnCreated = function(templateName, onCreated) {
    Tracker.autorun(function () {
      var template = orion.admin.template(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].onCreated(onCreated);
      }
    });
  }

  /**
   * Set onDestroyed to a template that maybe it doensn't exists yet
   */
  orion.admin.setTemplateOnDestroyed = function(templateName, onDestroyed) {
    Tracker.autorun(function () {
      var template = orion.admin.template(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].onDestroyed(onDestroyed);
      }
    });
  }
}<commit_msg>Rename templates manager<commit_after>orion.templates = {};

/**
 * We will save all the templates that any component need
 */
orion.templates.request = function(name) {
  check(name, String);
  orion.options.init('template.' + name);
}

/**
 * Reactively returns the name of the template
 */
orion.templates.get = function(name) {
  return orion.options.get('template.' + name);
}

/**
 * Assings a template to a template request
 */
orion.templates.set = function(requestedName, templateName) {
  return orion.options.set('template.' + requestedName, templateName);
}

if (Meteor.isClient) {

  /**
   * Set helpers to a template that maybe it doensn't exists yet
   */
  orion.templates.setHelpers = function(templateName, helpers) {
    Tracker.autorun(function () {
      var template = orion.templates.get(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].helpers(helpers);
      }
    });
  }

  /**
   * Set events to a template that maybe it doensn't exists yet
   */
  orion.templates.setEvents = function(templateName, events) {
    Tracker.autorun(function () {
      var template = orion.templates.get(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].events(events);
      }
    });
  }

  /**
   * Set onRendered to a template that maybe it doensn't exists yet
   */
  orion.templates.setOnRendered = function(templateName, onRendered) {
    Tracker.autorun(function () {
      var template = orion.templates.get(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].onRendered(onRendered);
      }
    });
  }

  /**
   * Set onCreated to a template that maybe it doensn't exists yet
   */
  orion.templates.setOnCreated = function(templateName, onCreated) {
    Tracker.autorun(function () {
      var template = orion.templates.get(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].onCreated(onCreated);
      }
    });
  }

  /**
   * Set onDestroyed to a template that maybe it doensn't exists yet
   */
  orion.templates.setOnDestroyed = function(templateName, onDestroyed) {
    Tracker.autorun(function () {
      var template = orion.templates.get(templateName);
      if (Blaze.isTemplate(Template[template])) {
        Template[template].onDestroyed(onDestroyed);
      }
    });
  }
}
{'fraction_non_alphanumeric': 0.12736842105263158, 'fraction_numerical': 0.0, 'mean_word_length': 3.2879061371841156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5294124', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1431, 'n_words': 302}