<commit_before>App.addChild('ReviewForm', _.extend({
  el: 'form#review_form',

  events: {
    'blur input' : 'checkInput',
    'change #contribution_country_id' : 'onCountryChange',
    'change #contribution_anonymous' : 'toggleAnonymousConfirmation',
    'click #next-step' : 'onNextStepClick'
  },

  onNextStepClick: function(){
    if(this.validate()){
      if(this.updateContribution()) {
        this.$errorMessage.hide();
        this.$('#next-step').hide();
        this.parent.payment.show();
      }
    }
    else{
      this.$errorMessage.slideDown('slow');
    }
  },

  toggleAnonymousConfirmation: function(){
    this.$('#anonymous-confirmation').slideToggle('slow');
  },

  onCountryChange: function(){
    if(this.$country.val() == '36'){
      this.nationalAddress();
    }
    else{
      this.internationalAddress();
    }
  },

  internationalAddress: function(){
    this.$state.data('old_value', this.$state.val());
    this.$state.val('outro / other')<commit_msg>Removed field validation from review_form when country is not brazil<commit_after>App.addChild('ReviewForm', _.extend({
  el: 'form#review_form',

  events: {
    'blur input' : 'customCheckInput',
    'change #contribution_country_id' : 'onCountryChange',
    'change #contribution_anonymous' : 'toggleAnonymousConfirmation',
    'click #next-step' : 'onNextStepClick'
  },

  customCheckInput: function(event){
    if (this.$country.val() !== '36') {
      return;
    }
    
    var $this = $(event.currentTarget);
    var validInput = true;
    var mask = $this.data('mask');
    if(mask){
      // just numbers
      if(!/.*\?.*/gi.test(mask) && /.*_.*/gi.test($this.val())){
        validInput = false;
      }
      // with optional numbers (?)
      if(/.*\?.*/gi.test(mask) && /.*_.*_.*/gi.test($this.val())){
        validInput = false;
      }
    }
    if(!validInput) {
      $this.trigger('invalid');
    }

    if(event.currentTarget.checkValidity() && validInput){
      var $target = this.$(event.currentTarget);
      $target.removeClass("error");
      this.$('[data-error-for=' + $target.prop('id') + ']').hide();
    }
  },

  onNextStepClick: function(){
    if(this.validate()){
      if(this.updateContribution()) {
        this.$errorMessage.hide();
        this.$('#next-step').hide();
        this.parent.payment.show();
      }
    }
    else{
      this.$errorMessage.slideDown('slow');
    }
  },

  toggleAnonymousConfirmation: function(){
    this.$('#anonymous-confirmation').slideToggle('slow');
  },

  onCountryChange: function(){
    if(this.$country.val() == '36'){
      this.nationalAddress();
    }
    else{
      this.internationalAddress();
    }
  },

  internationalAddress: function(){
    this.$state.data('old_value', this.$state.val());
    this.$state.val('outro / other')
{'fraction_non_alphanumeric': 0.1882770870337478, 'fraction_numerical': 0.0021314387211367673, 'mean_word_length': 2.983026874115983, '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': '5312512', 'n_tokens_mistral': 918, 'n_tokens_neox': 884, 'n_words': 132}