<commit_before><% css_classes_physical = "hidden-if-virtual" + (@server.virtual? ? " virtual" : "") %>
<% css_classes_virtual = "hidden-if-physical" + (@server.virtual? ? " virtual" : "") %>

<%= simple_form_for(@server) do |f| %>
  <%= action_links do %>
    <%= f.button :submit %>
    ou <%= link_to "Retourner à la liste", servers_path %>
    <% unless @server.new_record? %>
      | <%= link_to "Voir", @server %>
    <% end %>
  <% end %>

  <div id="server_general" class="grid_4">
  <table class="inputs full">
    <tbody>
      <%= tabular_errors @server %>
      <%= f.input :name, :required => true, :wrapper_class => 'th', :input_html => { :style => "width:10em;" } %>
      <tr class="wrapper server_applications">
        <td colspan="2"><label for="server[description]" class="input">Description :</label><br/><%= f.text_area :description, :size => "30x4" %></td>
      </tr>
      <%= f.association :operating_system, :collection => ancestry_options(
                                                            OperatingSystem.scoped.arrange(:order => 'name')
                                                          ){|i| "#{'-'*i.depth} #{i.name}"} %>
      <tr class="input checkbox optional">
        <td class="label"><%= content_tag :label, t(:server_type) %></td>
        <td class="content tiny checkboxes-as-radio">
          <%= f.input_field :virtual, :class => "radio-checkbox" %><%= content_tag :label, t(:virtual), :for => "server_virtual" %><br />
          <%= f.input_field :is_hypervisor, :class => "radio-checkbox" %><%= content_tag :label, t(:hypervisor), :for => "server_is_hypervisor" %><br />
          <%= f.input_field :network_device, :class => "radio-checkbox" %><%= content_tag :label, t(:network_device), :for => "server_network_device" %>
        </td>
      </tr>
      <%= f.association :hypervisor, :collection => Server.hypervisor_hosts.order(:name) - [@server],
                                     :wrapper_class => css_classes_virtual %>
      <tr class="input string optional">
        <td class="content checkboxes-as-radio" colspan="2">
          <label for="server[ipaddresses]" class="input"><%= t(:ipaddresses) %> :</label><br />
          <% f.object.ipaddresses.build if f.object.ipaddresses.size == 0 %>
          <%= f.simple_fields_for :ipaddresses do |ip_form| %>
            <%= render 'ipaddress_fields', :f => ip_form %>
          <% end %>
          <p class="add-field">
            <%= link_to_add_fields image_tag("new_button.png", :size => "14x15", :class=>"inline")+" ajouter", f, :ipaddresses %>
          </p>
        </td>
      </tr>
      <tr class="input string optional">
        <td class="content" colspan="2">
          <label for="server[physical_links]" class="input"><%= t(:server_links) %> :</label><br />
          <% f.object.physical_links.build if f.object.physical_links.size == 0 %>
          <%= f.simple_fields_for :physical_links do |pl_form| %>
            <%= render 'physical_link_fields', :f => pl_form %>
          <% end %>
          <p class="add-field">
            <%= link_to_add_fields image_tag("new_button.png", :size => "14x15", :class=>"inline")+" ajouter", f, :physical_links %>
          </p>
        </td>
      </tr>
      <!--<%= f.input :server_type %>-->
      <!--<%= f.input :previous_name %>-->
    </tbody>
    <tbody id="server-maintenance" class="<%= css_classes_physical %>">
      <tr><th colspan="2" class="secondary">Maintenance</th></tr>
      <%= f.association :mainteneur %>
      <%= f.input :delivered_on, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                 :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :maintained_until, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                     :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :contract_type %>
      <%= f.input :serial_number %>
    </tbody>
  </table>
  </div>

  <div id="server_hardware" class="grid_4">
  <table class="inputs full">
    <thead>
      <tr><th colspan="2" id="server-hardware-title"><%= @server.virtual? ? "Ressources" : "Matériel" %></th></tr>
    </thead>
    <tbody id="server-physical-hardware" class="<%= css_classes_physical %>">
      <%= f.association :physical_rack, :collection => PhysicalRack.all.map{|r| [r,r.id]} %>
      <%= f.input :model %>
      <%= f.input :manufacturer %><commit_msg>Display manufacturer before model in servers/form partial<commit_after><% css_classes_physical = "hidden-if-virtual" + (@server.virtual? ? " virtual" : "") %>
<% css_classes_virtual = "hidden-if-physical" + (@server.virtual? ? " virtual" : "") %>

<%= simple_form_for(@server) do |f| %>
  <%= action_links do %>
    <%= f.button :submit %>
    ou <%= link_to "Retourner à la liste", servers_path %>
    <% unless @server.new_record? %>
      | <%= link_to "Voir", @server %>
    <% end %>
  <% end %>

  <div id="server_general" class="grid_4">
  <table class="inputs full">
    <tbody>
      <%= tabular_errors @server %>
      <%= f.input :name, :required => true, :wrapper_class => 'th', :input_html => { :style => "width:10em;" } %>
      <tr class="wrapper server_applications">
        <td colspan="2"><label for="server[description]" class="input">Description :</label><br/><%= f.text_area :description, :size => "30x4" %></td>
      </tr>
      <%= f.association :operating_system, :collection => ancestry_options(
                                                            OperatingSystem.scoped.arrange(:order => 'name')
                                                          ){|i| "#{'-'*i.depth} #{i.name}"} %>
      <tr class="input checkbox optional">
        <td class="label"><%= content_tag :label, t(:server_type) %></td>
        <td class="content tiny checkboxes-as-radio">
          <%= f.input_field :virtual, :class => "radio-checkbox" %><%= content_tag :label, t(:virtual), :for => "server_virtual" %><br />
          <%= f.input_field :is_hypervisor, :class => "radio-checkbox" %><%= content_tag :label, t(:hypervisor), :for => "server_is_hypervisor" %><br />
          <%= f.input_field :network_device, :class => "radio-checkbox" %><%= content_tag :label, t(:network_device), :for => "server_network_device" %>
        </td>
      </tr>
      <%= f.association :hypervisor, :collection => Server.hypervisor_hosts.order(:name) - [@server],
                                     :wrapper_class => css_classes_virtual %>
      <tr class="input string optional">
        <td class="content checkboxes-as-radio" colspan="2">
          <label for="server[ipaddresses]" class="input"><%= t(:ipaddresses) %> :</label><br />
          <% f.object.ipaddresses.build if f.object.ipaddresses.size == 0 %>
          <%= f.simple_fields_for :ipaddresses do |ip_form| %>
            <%= render 'ipaddress_fields', :f => ip_form %>
          <% end %>
          <p class="add-field">
            <%= link_to_add_fields image_tag("new_button.png", :size => "14x15", :class=>"inline")+" ajouter", f, :ipaddresses %>
          </p>
        </td>
      </tr>
      <tr class="input string optional">
        <td class="content" colspan="2">
          <label for="server[physical_links]" class="input"><%= t(:server_links) %> :</label><br />
          <% f.object.physical_links.build if f.object.physical_links.size == 0 %>
          <%= f.simple_fields_for :physical_links do |pl_form| %>
            <%= render 'physical_link_fields', :f => pl_form %>
          <% end %>
          <p class="add-field">
            <%= link_to_add_fields image_tag("new_button.png", :size => "14x15", :class=>"inline")+" ajouter", f, :physical_links %>
          </p>
        </td>
      </tr>
      <!--<%= f.input :server_type %>-->
      <!--<%= f.input :previous_name %>-->
    </tbody>
    <tbody id="server-maintenance" class="<%= css_classes_physical %>">
      <tr><th colspan="2" class="secondary">Maintenance</th></tr>
      <%= f.association :mainteneur %>
      <%= f.input :delivered_on, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                 :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :maintained_until, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                     :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :contract_type %>
      <%= f.input :serial_number %>
    </tbody>
  </table>
  </div>

  <div id="server_hardware" class="grid_4">
  <table class="inputs full">
    <thead>
      <tr><th colspan="2" id="server-hardware-title"><%= @server.virtual? ? "Ressources" : "Matériel" %></th></tr>
    </thead>
    <tbody id="server-physical-hardware" class="<%= css_classes_physical %>">
      <%= f.association :physical_rack, :collection => PhysicalRack.all.map{|r| [r,r.id]} %>
      <%= f.input :manufacturer %>
      <%= f.input :model %>
{'fraction_non_alphanumeric': 0.19953570638956444, 'fraction_numerical': 0.006190581472474021, 'mean_word_length': 2.69265306122449, 'pattern_counts': {'":': 0, '<': 209, '<?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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4129424', 'n_tokens_mistral': 3136, 'n_tokens_neox': 2860, 'n_words': 560}