<commit_before>var _modals = {};
ReactiveModal = function(){
  // EV.call(this);
  this.buttons = {};
};
// _.extend(ReactiveModal.prototype, EV.prototype);
Template._reactiveModal.class = function(){
  var att;
  if(this.class){
    att = 'btn ' + this.class;
  }
  return att;
}
Template._reactiveModal.dismiss = function(){
  if(this.button.closeModalOnClick){
    return "modal";
  }
}

Template._reactiveModal.arrayify = function(obj){
  result = [];
  for (var key in obj) result.push({name:key,button:obj[key]});
  return result;
}

Template._reactiveModal.events({
  'click .modal-footer .reactive-modal-btn.btn': function(e){
    this.button.emit('click', this.button);
  }
});

ReactiveModal.initDialog = function (info){
  var key = "rm-"+Meteor.uuid();
  if(!info || !info.template){
    console.error("you must define a template for " , key);
  } else {
    info.key = key;
    _modals[key] = info;

    for(var button in info.buttons){
      var newButton = _.clone(info.buttons[button]);
      _.extend(newButton, new EV());
      info.buttons[button] = newButton;
      newButton.closeModalOnClick = (button.closeModalOnClick === undefined || info.closeModalOnClick) ? true : true;
    };
    UI.insert(UI.renderWithData(Template._reactiveModal, info), document.body)
  }

  var modalTarget = $('#' + key);
  info.show = function(){
    modalTarget.modal('show');
  }
  info.hide = function(){
    modalTarget.modal('hide');
  }
  info.modalTarget = modalTarget;
  return info;
};<commit_msg>fix the functionality for preventing a button from closing the modal<commit_after>var _modals = {};
ReactiveModal = function(){
  // EV.call(this);
  this.buttons = {};
};
// _.extend(ReactiveModal.prototype, EV.prototype);
Template._reactiveModal.class = function(){
  var att;
  if(this.class){
    att = 'btn ' + this.class;
  }
  return att;
}
Template._reactiveModal.dismiss = function(){
  if(this.button.closeModalOnClick){
    return "modal";
  }
}

Template._reactiveModal.arrayify = function(obj){
  result = [];
  for (var key in obj) result.push({name:key,button:obj[key]});
  return result;
}

Template._reactiveModal.events({
  'click .modal-footer .reactive-modal-btn.btn': function(e){
    this.button.emit('click', this.button);
  }
});

ReactiveModal.initDialog = function (info){
  var key = "rm-"+Meteor.uuid();
  if(!info || !info.template){
    console.error("you must define a template for " , key);
  } else {
    info.key = key;
    _modals[key] = info;

    for(var button in info.buttons){
      var newButton = _.clone(info.buttons[button]);
      _.extend(newButton, new EV());
      info.buttons[button] = newButton;
      newButton.closeModalOnClick = (info.buttons[button].closeModalOnClick === undefined || info.buttons[button].closeModalOnClick === true) ? true : false;
    };
    UI.insert(UI.renderWithData(Template._reactiveModal, info), document.body)
  }

  var modalTarget = $('#' + key);
  info.show = function(){
    modalTarget.modal('show');
  }
  info.hide = function(){
    modalTarget.modal('hide');
  }
  info.modalTarget = modalTarget;
  return info;
};
{'fraction_non_alphanumeric': 0.1642558662809386, 'fraction_numerical': 0.0, 'mean_word_length': 3.7656967840735067, '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': '5071567', 'n_tokens_mistral': 1017, 'n_tokens_neox': 996, 'n_words': 201}