<commit_before><%= javascript_include_tag 'calendar_date_select/calendar_date_select' %>
<%= stylesheet_link_tag 'calendar_date_select/default' %>

<%
  select_truncate_length=120
  all_organisms = Organism.find(:all,:order=>:title)
  culture_growth_options=options_for_select(CultureGrowthType.find(:all,:order=>:title).collect{|cg| [cg.title,cg.id]}.insert(0,"Not specified"),@specimen.culture_growth_type_id)
-%>
<div class="fold">

  <div class="foldTitle">
    <%= help_icon("Here you can associate the specimen with specific organism and strain.") -%>
    Organism <span class="required">*</span>
  </div>

  <div id="organisms_fold_content" class="foldContent" style="display: block;">
    <div class="yui-u first">

      <div class="association_step">
        <b>Step 1</b> - Choose an organism<br/><br/>
        <%= select_tag "specimen[organism_id]",
        options_for_select([["Select Organism ...", 0]]|all_organisms.collect{|o| [truncate(h(o.title), :length=>select_truncate_length), o.id]},@specimen.organism_id),
         {:style=>"width:90%",
          :onchange=>remote_function(:url=>{:action=>"show_existing_strains", :controller=>"strains",:element=>"existing_strains"},
          :with=>"'organism_id='+this.value",
          :before=>"show_ajax_loader('existing_strains')")+
          ";check_show_add_organism();$('specimen_strain_title').clear();return(false);"} -%>


      </div>
      <div id="extra_organism_details" style="display:none;">
        <div class="association_step">
          <b>Step 2</b> - Select method of culture growth (optional)<br/><br/>
          <%= select_tag "specimen[culture_growth_type_id]",culture_growth_options ,{:onchange=>"check_show_which_fields();"}-%>
          <br/>
         <div id="fields_for_cultured_cell_line_and_primary_cell_culture" style="display:none;">
           <table id="table1" border="1" cellpadding="10" >
               <tr>
                <td> <%= f.label :medium -%></td>
                <td> <%= f.text_field :medium  %></td>
               </tr>
               <tr>
                 <td><%= f.label :culture_format -%></td>
                <td> <%= f.text_field :culture_format  %></td>
               </tr>
               <tr>
                 <td><%= f.label :temperature -%></td>
                 <td><%= f.text_field :temperature  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :ph,"pH" -%></td>
                 <td><%= f.text_field :ph  %></td>
               </tr>
               <tr>
                 <td><%= f.label :confluency -%></td>
                 <td><%= f.text_field :confluency  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :passage -%></td>
                 <td><%= f.text_field :passage  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :viability -%></td>
                 <td><%= f.text_field :viability  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :purity -%></td>
                 <td><%= f.text_field :purity  %> </td>
               </tr>
         </table>
         </div>

         <div id="fields_for_vivo" style="display:none;">
           <br/>
           <table id="table2" border="1" >
           <tr>
             <td style="text-align:left;"><%= f.label :sex -%></td>
             <td style="text-align:left;"><%= f.select :sex,options_for_select({"female"=>true,"male"=>false},@specimen.sex),:include_blank=>"Not Specified"%> </td>
           </tr>

           <tr>
             <td style="text-align:left;"><%= f.label :age -%></td>
             <td style="text-align:left;"><%= f.text_field :age, :style => "width: 150px;" -%> weeks </td>
           </tr>

           <tr>
             <td style="text-align:left;"><%= f.label "Birthday" -%></td>
            <td style="text-align:left;"> <%= f.calendar_date_select :born, :time => "mixed" -%></td>
           </tr>
          </table>
         </div>

          <br/>

        </div>
        <div class="association_step">
          <b>Step 3</b> - Specify a strain (optional)<br/>
          <div id="existing_strains"></div>
          <%= f.text_field :strain_title %>
          <br/>
        </div>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript">
 var organism = new Array();
  function setStrainTextField(strain){
      $('specimen_strain_title').value = strain;
      new Effect.Highlight('specimen_strain_title');
  }


    function check_show_add_organism() {

      selected_id = $F('specimen_organism_id') ;
      if (selected_id == '0') {
        Effect.Fade('extra_organism_details');
      }
      else {
        Effect.Appear('extra_organism_details');
      }
    }
    function clearTable1(){
        var table1_elements = new Array();
        table1_elements = ["specimen_medium","specimen_culture_format","specimen_temperature","specimen_ph","specimen_confluency","specimen_passage","specimen_viability","specimen_purity"];
        for(var i=0; i<table1_elements.length;i++)
        {
           document.getElementById(table1_elements[i]).value="";
        }

    }
    function clearTable2() {
       $('specimen_sex').selectedIndex = 0;
       document.getElementById("specimen_age").value="";
       document.getElementById("specimen_born").value="";
     }

    function check_show_which_fields(){
        if($F('specimen_culture_growth_type_id')){
        selected_option_index=$("specimen_culture_growth_type_id").selectedIndex;
        selected_option=$("specimen_culture_growth_type_id").options[selected_option_index];
        title=selected_option.text;

        var div1 = document.getElementById('fields_for_cultured_cell_line_and_primary_cell_culture');
        var div2 = document.getElementById('fields_for_vivo');

        if (title=="cultured cell line" || title=="primary cell culture"){
            div1.style.display = 'block';
            div2.style.display='none';
            //clearTable2();


        }
        else if(title=="in vivo"){
            div2.style.display = 'block';
            div1.style.display='none';
            //clearTable1();




        }else{
           div1.style.display = 'none';
           div2.style.display='none';
          // clearTable1();
          // clearTable2();
<commit_msg> fixing broken HTML or Javascript during specimen controller test<commit_after><%= javascript_include_tag 'calendar_date_select/calendar_date_select' %>
<%= stylesheet_link_tag 'calendar_date_select/default' %>

<%
  select_truncate_length=120
  all_organisms = Organism.find(:all,:order=>:title)
  culture_growth_options=options_for_select(CultureGrowthType.find(:all,:order=>:title).collect{|cg| [cg.title,cg.id]}.insert(0,"Not specified"),@specimen.culture_growth_type_id)
-%>
<div class="fold">

  <div class="foldTitle">
    <%= help_icon("Here you can associate the specimen with specific organism and strain.") -%>
    Organism <span class="required">*</span>
  </div>

  <div id="organisms_fold_content" class="foldContent" style="display: block;">
    <div class="yui-u first">

      <div class="association_step">
        <b>Step 1</b> - Choose an organism<br/><br/>
        <%= select_tag "specimen[organism_id]",
        options_for_select([["Select Organism ...", 0]]|all_organisms.collect{|o| [truncate(h(o.title), :length=>select_truncate_length), o.id]},@specimen.organism_id),
         {:style=>"width:90%",
          :onchange=>remote_function(:url=>{:action=>"show_existing_strains", :controller=>"strains",:element=>"existing_strains"},
          :with=>"'organism_id='+this.value",
          :before=>"show_ajax_loader('existing_strains')")+
          ";check_show_add_organism();$('specimen_strain_title').clear();return(false);"} -%>


      </div>
      <div id="extra_organism_details" style="display:none;">
        <div class="association_step">
          <b>Step 2</b> - Select method of culture growth (optional)<br/><br/>
          <%= select_tag "specimen[culture_growth_type_id]",culture_growth_options ,{:onchange=>"check_show_which_fields();return(false);"}-%>
          <br/>
         <div id="fields_for_cultured_cell_line_and_primary_cell_culture" style="display:none;">
           <table id="table1" border="1" cellpadding="10" >
               <tr>
                <td> <%= f.label :medium -%></td>
                <td> <%= f.text_field :medium  %></td>
               </tr>
               <tr>
                 <td><%= f.label :culture_format -%></td>
                <td> <%= f.text_field :culture_format  %></td>
               </tr>
               <tr>
                 <td><%= f.label :temperature -%></td>
                 <td><%= f.text_field :temperature  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :ph,"pH" -%></td>
                 <td><%= f.text_field :ph  %></td>
               </tr>
               <tr>
                 <td><%= f.label :confluency -%></td>
                 <td><%= f.text_field :confluency  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :passage -%></td>
                 <td><%= f.text_field :passage  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :viability -%></td>
                 <td><%= f.text_field :viability  %> </td>
               </tr>
               <tr>
                 <td><%= f.label :purity -%></td>
                 <td><%= f.text_field :purity  %> </td>
               </tr>
         </table>
         </div>

         <div id="fields_for_vivo" style="display:none;">
           <br/>
           <table id="table2" border="1" >
           <tr>
             <td style="text-align:left;"><%= f.label :sex -%></td>
             <td style="text-align:left;"><%= f.select :sex,options_for_select({"female"=>true,"male"=>false},@specimen.sex),:include_blank=>"Not Specified"%> </td>
           </tr>

           <tr>
             <td style="text-align:left;"><%= f.label :age -%></td>
             <td style="text-align:left;"><%= f.text_field :age, :style => "width: 150px;" -%> weeks </td>
           </tr>

           <tr>
             <td style="text-align:left;"><%= f.label "Birthday" -%></td>
            <td style="text-align:left;"> <%= f.calendar_date_select :born, :time => "mixed" -%></td>
           </tr>
          </table>
         </div>

          <br/>

        </div>
        <div class="association_step">
          <b>Step 3</b> - Specify a strain (optional)<br/>
          <div id="existing_strains"></div>
          <%= f.text_field :strain_title %>
          <br/>
        </div>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript">
 var organism = new Array();
  function setStrainTextField(strain){
      $('specimen_strain_title').value = strain;
      new Effect.Highlight('specimen_strain_title');
  }


    function check_show_add_organism() {

      selected_id = $F('specimen_organism_id') ;
      if (selected_id == '0') {
        Effect.Fade('extra_organism_details');
      }
      else {
        Effect.Appear('extra_organism_details');
      }
    }


    function check_show_which_fields(){
        if($F('specimen_culture_growth_type_id')){
        selected_option_index=$("specimen_culture_growth_type_id").selectedIndex;
        selected_option=$("specimen_culture_growth_type_id").options[selected_option_index];
        title=selected_option.text;

        var div1 = document.getElementById('fields_for_cultured_cell_line_and_primary_cell_culture');
        var div2 = document.getElementById('fields_for_vivo');

        if (title=="cultured cell line" || title=="primary cell culture"){
            div1.style.display = 'block';
            div2.style.display='none';


        }
        else if(title=="in vivo"){
            div2.style.display = 'block';
            div1.style.display='none';




        }else{
           div1.style.display = 'none';
           div2.style.display='none';

{'fraction_non_alphanumeric': 0.17627883650952858, 'fraction_numerical': 0.0056837178201270475, 'mean_word_length': 2.2771843330594357, 'pattern_counts': {'":': 0, '<': 282, '<?xml version=': 0, '>': 315, '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': '2226894', 'n_tokens_mistral': 4014, 'n_tokens_neox': 3735, 'n_words': 615}