<commit_before><% content_for :subnav do %>
  <li><%= link_to 'Admin Home', admin_path %></li>
<% end %>

<% content_for :sidebar do %>
  <p>
    There are currently <%= pluralize @admin_count, 'administrator' %>.
  </p>
  
  <% if Site.current.max_admins.nil? or Admin.count < Site.current.max_admins %>
  
    <%= form_remote_tag :url => search_path %>
      <%= hidden_field_tag :select_person, true %>
      <p>
        Add an individual.<br/>
        <label for="name">Name:</label> <%= text_field_tag 'name' %>
        <br/>
        <%= submit_tag 'Add Person' %>
      </p>
    </form>
    
    <div id="add_member" style="display:none;">
      <% form_tag(administration_admins_path) do %>
        <%= select_tag :template_id, options_for_select([['Individual', 0]] + @templates.map { |t| [t.template_name, t.id] }) %>
        <div id="results"></div>
        <p><%= submit_tag 'Add Selected' %></p>
      <% end %>
    </div>
    
    <% form_tag(administration_admins_path) do %>
      <p>
        Create a new admin template.<br/>
        <label for="template_name">Name:</label> <%= text_field_tag 'template_name' %>
        <br/>
        <%= submit_tag 'Add Template' %><br/>
        Templates allow you to group admins with identical privileges together.
      </p>
    <% end %>
    
  <% end %>
  
<% end %>

<h2>Administrators</h2>

<% @admins.each do |admin| %>
  <div style="margin-bottom:3px;">
    <%= link_to_function image_tag('plus.gif', :alt => 'show privileges', :class => 'icon'), "Element.toggle('privileges_#{admin.id}')" %>
    <% if admin.template_name %>
      <strong><%=h admin.template_name %></strong>
    <% else %>
      <%= link_to h(admin.person.name), admin.person %>
    <% end %>
    <%= link_to 'x', administration_admin_path(admin), :method => 'delete', :confirm => 'Are you sure?', :class => 'discreet' %>
    <div id="privileges_<%= admin.id %>" style="display:none;font-size:smaller;margin-left:15px;">
      <%= check_box_tag 'select_all', true, false, :onclick => "new Ajax.Request('#{administration_admin_path(admin)}', {method:'PUT',parameters:'name=*&value='+this.checked})", :id => "select_all_#{admin.id}", :class => 'checkbox' %>
      <em>select all</em><br/>
      <% all_selected = true %>
      <% Admin.privileges.sort.each do |privilege| %>
        <% next if %w(assign_checkin_cards manage_checkin).include?(privilege) and not Setting.get(:features, :checkin_modules) %>
        <% unless admin.person == @logged_in and privilege == 'manage_access' %>
          <span class="nowrap">
            <%= check_box_tag privilege, true, admin.flags[privilege], :id => "#{privilege}_#{admin.id}", :onclick => "new Ajax.Request('#{administration_admin_path(admin)}', {method:'PUT',parameters:'name='+this.name+'&value='+this.checked})", :class => "checkbox privilege privilege#{admin.id}" %><span id="admin_<%= admin.id %>_<%= privilege %>"><%=h privilege.gsub('_', ' ') %></span>
          </span>
          <% all_selected = false unless admin.flags[privilege] %>
        <% end %>
      <% end %>
      <% if all_selected %><script type="text/javascript">$('select_all_<%= admin.id %>').checked = true</script><% end %>
      <% if admin.template_name %>
        <% admin.people.each do |person| %>
          <br/>
          <%= link_to h(person.name), person %>
          <%= link_to 'x', administration_admin_path(admin, :person_id => person.id), :method => 'delete', :confirm => 'Are you sure?', :class => 'discreet' %>
        <% end %>
      <% end %>
    </div>
  </div>
<% end %><commit_msg>Order admins by name within an admin template.<commit_after><% content_for :subnav do %>
  <li><%= link_to 'Admin Home', admin_path %></li>
<% end %>

<% content_for :sidebar do %>
  <p>
    There are currently <%= pluralize @admin_count, 'administrator' %>.
  </p>
  
  <% if Site.current.max_admins.nil? or Admin.count < Site.current.max_admins %>
  
    <%= form_remote_tag :url => search_path %>
      <%= hidden_field_tag :select_person, true %>
      <p>
        Add an individual.<br/>
        <label for="name">Name:</label> <%= text_field_tag 'name' %>
        <br/>
        <%= submit_tag 'Add Person' %>
      </p>
    </form>
    
    <div id="add_member" style="display:none;">
      <% form_tag(administration_admins_path) do %>
        <%= select_tag :template_id, options_for_select([['Individual', 0]] + @templates.map { |t| [t.template_name, t.id] }) %>
        <div id="results"></div>
        <p><%= submit_tag 'Add Selected' %></p>
      <% end %>
    </div>
    
    <% form_tag(administration_admins_path) do %>
      <p>
        Create a new admin template.<br/>
        <label for="template_name">Name:</label> <%= text_field_tag 'template_name' %>
        <br/>
        <%= submit_tag 'Add Template' %><br/>
        Templates allow you to group admins with identical privileges together.
      </p>
    <% end %>
    
  <% end %>
  
<% end %>

<h2>Administrators</h2>

<% @admins.each do |admin| %>
  <div style="margin-bottom:3px;">
    <%= link_to_function image_tag('plus.gif', :alt => 'show privileges', :class => 'icon'), "Element.toggle('privileges_#{admin.id}')" %>
    <% if admin.template_name %>
      <strong><%=h admin.template_name %></strong>
    <% else %>
      <%= link_to h(admin.person.name), admin.person %>
    <% end %>
    <%= link_to 'x', administration_admin_path(admin), :method => 'delete', :confirm => 'Are you sure?', :class => 'discreet' %>
    <div id="privileges_<%= admin.id %>" style="display:none;font-size:smaller;margin-left:15px;">
      <%= check_box_tag 'select_all', true, false, :onclick => "new Ajax.Request('#{administration_admin_path(admin)}', {method:'PUT',parameters:'name=*&value='+this.checked})", :id => "select_all_#{admin.id}", :class => 'checkbox' %>
      <em>select all</em><br/>
      <% all_selected = true %>
      <% Admin.privileges.sort.each do |privilege| %>
        <% next if %w(assign_checkin_cards manage_checkin).include?(privilege) and not Setting.get(:features, :checkin_modules) %>
        <% unless admin.person == @logged_in and privilege == 'manage_access' %>
          <span class="nowrap">
            <%= check_box_tag privilege, true, admin.flags[privilege], :id => "#{privilege}_#{admin.id}", :onclick => "new Ajax.Request('#{administration_admin_path(admin)}', {method:'PUT',parameters:'name='+this.name+'&value='+this.checked})", :class => "checkbox privilege privilege#{admin.id}" %><span id="admin_<%= admin.id %>_<%= privilege %>"><%=h privilege.gsub('_', ' ') %></span>
          </span>
          <% all_selected = false unless admin.flags[privilege] %>
        <% end %>
      <% end %>
      <% if all_selected %><script type="text/javascript">$('select_all_<%= admin.id %>').checked = true</script><% end %>
      <% if admin.template_name %>
        <% admin.people.all(:order => 'last_name, first_name').each do |person| %>
          <br/>
          <%= link_to h(person.name), person %>
          <%= link_to 'x', administration_admin_path(admin, :person_id => person.id), :method => 'delete', :confirm => 'Are you sure?', :class => 'discreet' %>
        <% end %>
      <% end %>
    </div>
  </div>
<% end %>
{'fraction_non_alphanumeric': 0.20155902004454343, 'fraction_numerical': 0.0016703786191536749, 'mean_word_length': 3.294680215182307, 'pattern_counts': {'":': 0, '<': 191, '<?xml version=': 0, '>': 222, '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': '4814961', 'n_tokens_mistral': 2575, 'n_tokens_neox': 2353, 'n_words': 483}