<commit_before>:javascript

  var role_ids_by_org = JSON.parse('#{(OrganizationRoleMapping.role_ids_by_org || {}).to_json}');

  // Document Ready
  $(document).ready(function(){

  	var selected_set_name = 'user_organization_ids';
  	var shuttle_target_id = 'selected_grantees'

  	// Add an submit event handler for the form
  	$(".user_profile_form").submit(function(){
      if ($(this).valid()) {
        var shuttle_target = $('#' + shuttle_target_id);
        var form_target = $('#' + selected_set_name);
        // select all the options in the selected array from the other shuttle list list
        var id_list = new Array();
        shuttle_target.children().map(function () {
          id_list.push($(this).val());
        });
        //var id_list = new Array();
        //alert(id_list);
        form_target.val(id_list);
        //elem.children().map(function() {
        //	id_list.push($(this).val());
        //});
        //alert($('#' + target_id).val());
        return true;
      }
  	});

    var t = $('#org_select').bootstrapTransfer({
    	target_id: shuttle_target_id,
     	hilite_selection: false
     });
    if (t.length) {
      var filter_orgs = [];
      var selected = [];
      var orgs = JSON.parse('#{Organization.where(id: @organization_list).map{|o| [o.coded_name, o.id]}.to_json}');
      var user_orgs = JSON.parse('#{@user.organizations.pluck(:id).to_json}');


      $.each(orgs, function( index, value ) {
        filter_orgs.push({value: value[1], content: value[0]});
      });

      $.each(user_orgs, function( index, value ) {
        selected.push(value);
      });

      t.populate(filter_orgs);
      t.set_values(selected);
    }


    $('#user_role_ids').change();

    $('btn.selector-clearall').hide();

    var org_id = $('#user_organization_id').val();
    update_role_list_by_organization(org_id);
    $('#org_select').data().bootstrapTransfer.move_all(true, false); // clear out all selected values
    $('#org_select').data().bootstrapTransfer.set_values([org_id])

    update_disabled_orgs();

    transam.make_same_height('.form-part');
  });


  $('#user_role_ids').change(function() {
      $('.super-privilege').each(function(){

          if(parseInt($(this).data('resource-id')) == parseInt($('#user_role_ids').val())) {
              $(this).parent().parent().show(); // get span of checkbox
          } else {
              $(this).parent().parent().hide();
          }
      });

  });

  // Organization change: reset role, borough, and boroughs
  $('#user_organization_id').on('change', function(e) {
      var org_id = $(this).val();
      update_role_list_by_organization(org_id);
      $('#org_select').data().bootstrapTransfer.move_all(true, false); // clear out all selected values
      $('#org_select').data().bootstrapTransfer.set_values([org_id])<commit_msg>[fixes#143603505] automatically fill in fields when org automatically set on load, disable transit ops in org list when planning partner user<commit_after>:javascript

  var role_ids_by_org = JSON.parse('#{(OrganizationRoleMapping.role_ids_by_org || {}).to_json}');

  // Document Ready
  $(document).ready(function(){

  	var selected_set_name = 'user_organization_ids';
  	var shuttle_target_id = 'selected_grantees'

  	// Add an submit event handler for the form
  	$(".user_profile_form").submit(function(){
      if ($(this).valid()) {
        var shuttle_target = $('#' + shuttle_target_id);
        var form_target = $('#' + selected_set_name);
        // select all the options in the selected array from the other shuttle list list
        var id_list = new Array();
        shuttle_target.children().map(function () {
          id_list.push($(this).val());
        });
        //var id_list = new Array();
        //alert(id_list);
        form_target.val(id_list);
        //elem.children().map(function() {
        //	id_list.push($(this).val());
        //});
        //alert($('#' + target_id).val());
        return true;
      }
  	});

    var t = $('#org_select').bootstrapTransfer({
    	target_id: shuttle_target_id,
     	hilite_selection: false
     });
    if (t.length) {
      var filter_orgs = [];
      var selected = [];
      var orgs = JSON.parse('#{Organization.where(id: @organization_list).map{|o| [o.coded_name, o.id]}.to_json}');
      var user_orgs = JSON.parse('#{@user.organizations.pluck(:id).to_json}');


      $.each(orgs, function( index, value ) {
        filter_orgs.push({value: value[1], content: value[0]});
      });

      $.each(user_orgs, function( index, value ) {
        selected.push(value);
      });

      t.populate(filter_orgs);
      t.set_values(selected);
    }


    $('#user_role_ids').change();

    $('btn.selector-clearall').hide();

    $('#user_organization_id').change();

    transam.make_same_height('.form-part');
  });


  $('#user_role_ids').change(function() {
      $('.super-privilege').each(function(){

          if(parseInt($(this).data('resource-id')) == parseInt($('#user_role_ids').val())) {
              $(this).parent().parent().show(); // get span of checkbox
          } else {
              $(this).parent().parent().hide();
          }
      });

  });

  // Organization change: reset role, borough, and boroughs
  $('#user_organization_id').on('change', function(e) {
      var org_id = $(this).val();
      update_role_list_by_organization(org_id);
      $('#org_select').data().bootstrapTransfer.move_all(true, false); // clear out all selected values
      $('#org_select').data().bootstrapTransfer.set_values([org_id])
{'fraction_non_alphanumeric': 0.1796116504854369, 'fraction_numerical': 0.0023372887450557353, 'mean_word_length': 2.939801699716714, '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': '1370339', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1703, 'n_words': 303}