<commit_before>AutoForm.addInputType("bootstrap-url", {
  template: "afBootstrapUrl",
  valueOut: function () {
    var url = this.val();
    if (!!url) {
      // add http:// if missing
      if (url.substring(0, 7) !== "http://" && url.substring(0, 8) !== "https://") {
        url = "http://"+url;
      }
      // add trailing / if missing (unless URL contains a "?")
      if (url.slice(-1) !== "/" && url.indexOf("?") === -1) {
        url = url + "/";
      }
      return url;
    }
  }
});

Template.afBootstrapUrl_bootstrap3.helpers({
  atts: function addFormControlAtts() {
    console.log(this);
    var atts = _.clone(this.atts);
    // Add bootstrap class
    atts = AutoForm.Utility.addClass(atts, "form-control");
    return atts;
  }
});

<commit_msg>Return null if bootstrap-url is blank. Fixes #1012<commit_after>AutoForm.addInputType("bootstrap-url", {
  template: "afBootstrapUrl",
  valueOut: function () {
    var url = this.val();
    if (!!url) {
      // add http:// if missing
      if (url.substring(0, 7) !== "http://" && url.substring(0, 8) !== "https://") {
        url = "http://"+url;
      }
      // add trailing / if missing (unless URL contains a "?")
      if (url.slice(-1) !== "/" && url.indexOf("?") === -1) {
        url = url + "/";
      }
      return url;
    }
    else {
      return null;
    }
  }
});

Template.afBootstrapUrl_bootstrap3.helpers({
  atts: function addFormControlAtts() {
    console.log(this);
    var atts = _.clone(this.atts);
    // Add bootstrap class
    atts = AutoForm.Utility.addClass(atts, "form-control");
    return atts;
  }
});


{'fraction_non_alphanumeric': 0.19266625233064014, 'fraction_numerical': 0.011187072715972654, 'mean_word_length': 2.3752620545073375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1890698', 'n_tokens_mistral': 555, 'n_tokens_neox': 542, 'n_words': 120}