<commit_before>/* Dataset allowed_users and adquire_url toggler
 * allowed_users, adquire_url and searchable can only be active when a 
 * user attempts to create a private dataset outside an organization 
 */

this.ckan.module('allowed-users', function ($, _) {
  return {
    initialize: function() {
      $('#field-private').on('change', this._onChange);
      $('#field-organizations').on('change', this._onChange);
      this._onChange();
    },
    _onChange: function() {
      var ds_private = $('#field-private').val();

      if (ds_private == "True") {
        $('#field-allowed_users_str').prop('disabled', false);  //Enable
        $('#field-adquire_url').prop('disabled', false);    //Enable
        $('#field-searchable').prop('disabled', false);    //Enable
      } else {
        $('#field-allowed_users_str').prop('disabled', true);   //Disable
        $('#field-adquire_url').prop('disabled', true);     //Disable
        $('#field-searchable').prop('disabled', true);      //Disable
        
        //Remove previous values
        $('#s2id_field-allowed_users_str .select2-search-choice').remove();
        $('#field-allowed_users_str').val('');
        $('#field-adquire_url').val('');
        $('#field-searchable').val('True');
      }
    }
  };
});
<commit_msg>Remove allowed users correctly<commit_after>/* Dataset allowed_users and adquire_url toggler
 * allowed_users, adquire_url and searchable can only be active when a 
 * user attempts to create a private dataset outside an organization 
 */

this.ckan.module('allowed-users', function ($, _) {
  return {
    initialize: function() {
      $('#field-private').on('change', this._onChange);
      $('#field-organizations').on('change', this._onChange);
      this._onChange();
    },
    _onChange: function() {
      var ds_private = $('#field-private').val();

      if (ds_private == "True") {
        $('#field-allowed_users_str').prop('disabled', false);  //Enable
        $('#field-adquire_url').prop('disabled', false);    //Enable
        $('#field-searchable').prop('disabled', false);    //Enable
      } else {
        $('#field-allowed_users_str').prop('disabled', true);   //Disable
        $('#field-adquire_url').prop('disabled', true);     //Disable
        $('#field-searchable').prop('disabled', true);      //Disable
        
        //Remove previous values
        $('#field-allowed_users_str').select2('val', '');
        $('#field-adquire_url').val('');
        $('#field-searchable').val('True');
      }
    }
  };
});

{'fraction_non_alphanumeric': 0.19011857707509883, 'fraction_numerical': 0.0011857707509881424, 'mean_word_length': 2.9546875, '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': '1685644', 'n_tokens_mistral': 714, 'n_tokens_neox': 732, 'n_words': 143}