<commit_before><% add_crumb t('crumbs.users', "Users") %>
<% @active_tab = "users" %>
<% content_for :page_title do %>
  <% if @query %>
    <%= t('search_for_user', 'User Search results for %{user_name}', :user_name => (params[:user][:name] rescue '')) %>
  <% else %>
    <%= t('all_users', 'All Users') %>
  <% end %>
<% end %>

<% content_for :right_side do %>
  <div class="rs-margin-lr rs-margin-top" style="padding-bottom: 20px;">
    <a href="<%= context_url(@context, :context_groups_url) %>" class="btn button-sidebar-wide user_groups"><i class="icon-group"></i> <%= t('buttons.user_groups', 'View User Groups') %></a>
    <a href="<%= context_url(@context, :context_avatars_url) %>" class="btn button-sidebar-wide manage_profile_pictures"><i class="icon-student-view"></i> <%= t('buttons.manage_profile_pictures', 'Manage Profile Pictures') %></a>
  </div>

  <% if @enrollment_terms.size > 1 %>
    <h2><%= t('titles.choose_term', 'Choose Term') %></h2>
    <div class="rs-margin-lr rs-margin-bottom">
      <label for="enrollment_term"><%= before_label('show_users_for_term', 'Show users with enrollments in the term') %></label><br />
      <% form_tag(account_users_path, :method => :get) do %>
        <select id="enrollment_term_id" name="enrollment_term_id">
          <option value=''>--</option>
          <%= options_from_collection_for_select(@enrollment_terms,
                                                 :id, :name,
                                                 params[:enrollment_term_id].to_i) %>
        </select>
      <% end %>
    </div>
  <% end %>

  <%= render :partial => 'shared/accounts_right_side_shared' %>
  <%= render :partial => 'accounts/add_course_or_user', :locals => {:hide_add_course => true} %>
<% end %>

<% if @query %>
  <h2><%= t('titles.search_results', 'Search results for "%{search_term}"', :search_term => (params[:user][:name] rescue '')) %></h2>
  <%= t('no_results_found', "No Results Found") if @users.empty? %>
<% else %>
  <h2><%= t('titles.all_users', 'All Users') %></h2>
<% end %>

<% unless @users.blank? %>
  <%= will_paginate(@users, :style=>"margin-bottom: 1em;") %>

  <table border="1" class="table table-striped ">
    <thead>
      <tr>
        <td width="200px"><%= t 'table_headings.name', 'Name' %></td>
        <td><%= t 'table_headings.account', 'Account' %></td>
        <td><%= t 'table_headings.job_number', 'Job Number' %></td>
        <td><%= t 'table_headings.job_position', 'Job Position' %></td>
        <td><%= t 'table_headings.is_external', 'Is External' %></td>
        <td><%= t 'table_headings.tags', 'Tags' %></td>
        <td><%= t 'table_headings.source', 'Source' %></td>
      </tr>
    </thead>
    <tbody>
      <% @users.each do |user| %>
        <% user_account_association = user.user_account_associations.filter_by_account_id(params[:account_id]).first %>
        <tr>
          <td><%= link_to(user.last_name_first_or_unnamed, context_url(@context, :context_user_url, user)) %></td>
          <td>
            <%= get_user_associated_accounts(user, params[:account_id]) %>
          <td><%= user_account_association.job_number %></td>
          <td><%= user_account_association.call_or_mock('job_position', 'name') %></td>
          <td><%= user_account_association.external == true ? 'yes' : 'no' %></td>
          <td><%= user_account_association.tag_list %></td>
          <td><%= user_account_association.source %></td>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= will_paginate(@users, :style=>"margin-top: 1em;") %>
<% else %>
  <%= t 'empty_users', 'Empty users' %> 
<% end %>
<% js_block do %>
<script type="text/javascript">
require([
  'jquery', /* $ */
  'jqueryui/dialog',
  'jqueryui/easyDialog'
], function($) {

  $(document).ready(function() {
      $('#enrollment_term_id').change(function() { $(this).closest('form').submit(); });

      $('.user-state-op').bind('click', function(){
        var _this = $(this);
        var text = _this.attr('state') == '0' ? '<%= t "js.edit_confirm_to_freeze", "Are you sure to freeze this user?" %>' : '<%= t "js.edit_confirm_to_active", "Are you sure to active this user?" %>';
        $('#jxb-message-dialog').easyDialog({
          title: "<%= t 'js.user_state_modify_tip', 'Edit user state' %>",
          content: text,
          confirmCallback: function(){
            $.getJSON(_this.attr('link'), function(data){
              if(data.flag) {
                alert("<%= t 'js.update_successfully', 'Update successfully' %>");
                window.location.reload();
              }else{
                alert("<%= t 'js.update_failure', 'Update failure' %>");
              }
            });
          }
        }, 'confirm');
        return false;
      });
  });
});
</script>
<% end %>
<commit_msg>active or freeze users bug<commit_after><% add_crumb t('crumbs.users', "Users") %>
<% @active_tab = "users" %>
<% content_for :page_title do %>
  <% if @query %>
    <%= t('search_for_user', 'User Search results for %{user_name}', :user_name => (params[:user][:name] rescue '')) %>
  <% else %>
    <%= t('all_users', 'All Users') %>
  <% end %>
<% end %>

<% content_for :right_side do %>
  <div class="rs-margin-lr rs-margin-top" style="padding-bottom: 20px;">
    <a href="<%= context_url(@context, :context_groups_url) %>" class="btn button-sidebar-wide user_groups"><i class="icon-group"></i> <%= t('buttons.user_groups', 'View User Groups') %></a>
    <a href="<%= context_url(@context, :context_avatars_url) %>" class="btn button-sidebar-wide manage_profile_pictures"><i class="icon-student-view"></i> <%= t('buttons.manage_profile_pictures', 'Manage Profile Pictures') %></a>
  </div>

  <% if @enrollment_terms.size > 1 %>
    <h2><%= t('titles.choose_term', 'Choose Term') %></h2>
    <div class="rs-margin-lr rs-margin-bottom">
      <label for="enrollment_term"><%= before_label('show_users_for_term', 'Show users with enrollments in the term') %></label><br />
      <% form_tag(account_users_path, :method => :get) do %>
        <select id="enrollment_term_id" name="enrollment_term_id">
          <option value=''>--</option>
          <%= options_from_collection_for_select(@enrollment_terms,
                                                 :id, :name,
                                                 params[:enrollment_term_id].to_i) %>
        </select>
      <% end %>
    </div>
  <% end %>

  <%= render :partial => 'shared/accounts_right_side_shared' %>
  <%= render :partial => 'accounts/add_course_or_user', :locals => {:hide_add_course => true} %>
<% end %>

<% if @query %>
  <h2><%= t('titles.search_results', 'Search results for "%{search_term}"', :search_term => (params[:user][:name] rescue '')) %></h2>
  <%= t('no_results_found', "No Results Found") if @users.empty? %>
<% else %>
  <h2><%= t('titles.all_users', 'All Users') %></h2>
<% end %>

<% unless @users.blank? %>
  <%= will_paginate(@users, :style=>"margin-bottom: 1em;") %>

  <table border="1" class="table table-striped ">
    <thead>
      <tr>
        <td width="200px"><%= t 'table_headings.name', 'Name' %></td>
        <td><%= t 'table_headings.account', 'Account' %></td>
        <td><%= t 'table_headings.job_number', 'Job Number' %></td>
        <td><%= t 'table_headings.job_position', 'Job Position' %></td>
        <td><%= t 'table_headings.is_external', 'Is External' %></td>
        <td><%= t 'table_headings.tags', 'Tags' %></td>
        <td><%= t 'table_headings.source', 'Source' %></td>
      </tr>
    </thead>
    <tbody>
      <% @users.each do |user| %>
        <% user_account_association = user.user_account_associations.filter_by_account_id(params[:account_id]).first %>
        <tr>
          <td><%= link_to(user.last_name_first_or_unnamed, context_url(@context, :context_user_url, user)) %></td>
          <td>
            <%= get_user_associated_accounts(user, params[:account_id]) %>
          <td><%= user_account_association.job_number %></td>
          <td><%= user_account_association.call_or_mock('job_position', 'name') %></td>
          <td><%= user_account_association.external == true ? 'yes' : 'no' %></td>
          <td><%= user_account_association.tag_list %></td>
          <td><%= user_account_association.source %></td>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= will_paginate(@users, :style=>"margin-top: 1em;") %>
<% else %>
  <%= t 'empty_users', 'Empty users' %> 
<% end %>
<div id="jxb-message-dialog"></div>
<% js_block do %>
<script type="text/javascript">
require([
  'jquery', /* $ */
  'jqueryui/dialog',
  'jqueryui/easyDialog'
], function($) {

  $(document).ready(function() {
      $('#enrollment_term_id').change(function() { $(this).closest('form').submit(); });

      $('.user-state-op').bind('click', function(){
        var _this = $(this);
        var text = _this.attr('state') == '0' ? '<%= t "js.edit_confirm_to_freeze", "Are you sure to freeze this user?" %>' : '<%= t "js.edit_confirm_to_active", "Are you sure to active this user?" %>';
        $('#jxb-message-dialog').easyDialog({
          title: "<%= t 'js.user_state_modify_tip', 'Edit user state' %>",
          content: text,
          confirmButtonClass: 'btn-primary',
          confirmCallback: function(){
            $.getJSON(_this.attr('link'), function(data){
              if(data.flag) {
                alert("<%= t 'js.update_successfully', 'Update successfully' %>");
                window.location.reload();
              }else{
                alert("<%= t 'js.update_failure', 'Update failure' %>");
              }
            });
          }
        }, 'confirm');
        return false;
      });
  });
});
</script>
<% end %>

{'fraction_non_alphanumeric': 0.21080355298492048, 'fraction_numerical': 0.003305102251600909, 'mean_word_length': 3.0667786644267117, 'pattern_counts': {'":': 0, '<': 253, '<?xml version=': 0, '>': 273, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2950214', 'n_tokens_mistral': 3442, 'n_tokens_neox': 3197, 'n_words': 618}