<commit_before><% # render the (possibly shared) calculator %>

<% width_dom_id = "product_area_input_#{product_customization_type.customizable_product_options.first.id}" %>
<% height_dom_id = "product_area_input_#{product_customization_type.customizable_product_options.second.id}" %>

<%= render :partial => "spree/products/customizations/calculator/#{calculator_name(product_customization_type)}",
           :locals => {:calculator=>product_customization_type.calculator} %>

  <% # add the 'change' listener for this particular file input, which will make use of the calculator above %>

  <%= content_for :head do %>
    <%= javascript_tag do %>

      function product_area_keyup() { 
        var tf = $(this);

        delay(function(){

          // update the hidden price field for this file input
          $(tf).parent().parent().find(".customization_price").val(calculate_product_area_price(tf));
          updatePrice();
        }, 1000 ); // delay
      }); // keyup

      $(document).on('keyup', '#<%= width_dom_id %>', product_area_keyup);
      $(document).on('keyup', '#<%= height_dom_id %>', product_area_keyup);
    <% end %>
  <% end %>

<%= field_set_tag product_customization_type.presentation do %>
  <ol>
    <li>
      <% option = product_customization_type.customizable_product_options.first %>

  	  <label for="<%= width_dom_id %>"><%= option.presentation %></label>
      <% # create a slightly shorter dom_id field below.  I wish I could make use of dom_id for all strings that had [ && ] %>
	    <%= text_field_tag "#{param_prefix}[#{option.id}]",
                         "",
                         :id => width_dom_id ,:style=>"float: left;", :class=>"customization" %>

    </li>


    <li>
      <% option = product_customization_type.customizable_product_options.second %>

  	  <label for="<%= height_dom_id %>"><%= option.presentation %></label>
	    <%= text_field_tag "#{param_prefix}[#{option.id}]",
                         "",
                         :id => height_dom_id ,:style=>"float: left;", :class=>"customization" %>
    </li>

    <% # the price is stored here on change, and later collected by the product-wide updatePrice() %>
    <%= hidden_field_tag "customization_price", "0", :class => "customization_price" %>

  </ol>
<% end # field_set_tag %><commit_msg>modified product area calculator to new style<commit_after><% # render the (possibly shared) calculator %>

<% width_dom_id  = "product_area_input_#{product_customization_type.customizable_product_options.first.id}"  %>
<% height_dom_id = "product_area_input_#{product_customization_type.customizable_product_options.second.id}" %>

<%= render partial: "spree/products/customizations/calculator/#{calculator_name product_customization_type}",
           locals:  {calculator: product_customization_type.calculator} %>

  <% # add the 'change' listener for this particular file input, which will make use of the calculator above %>

  <%= content_for :head do %>
    <%= javascript_tag do %>

      function product_area_keyup() { 
        var tf = $(this);

        delay(function(){

          // update the hidden price field for this file input
          $(tf).parent().parent().find(".customization_price").val(calculate_product_area_price(tf));
          updatePrice();
        }, 1000 ); // delay
      }); // keyup

      $(document).on('keyup', '#<%= width_dom_id %>', product_area_keyup);
      $(document).on('keyup', '#<%= height_dom_id %>', product_area_keyup);
    <% end %>
  <% end %>

<%= field_set_tag product_customization_type.presentation do %>
  <% option = product_customization_type.customizable_product_options.first %>
  
  <div class="form-group">   
    <% # create a slightly shorter dom_id field below.  I wish I could make use of dom_id for all strings that had [ && ] %>
    <%= hidden_field_tag "#{param_prefix}[customization_id]", product_customization_type.id %>
    <%= hidden_field_tag "#{param_prefix}[option_id]", product_customization_type.customizable_product_options.first.id %>
    
    <div>
      <label for="<%= width_dom_id %>"><%= option.presentation %></label>
  	    <%= text_field_tag "#{param_prefix}[option_value]", "",
    	                     :id => width_dom_id ,:style=>"float: left;", :class=>"customization form-control " %>
    </div>
    
    <% option = product_customization_type.customizable_product_options.second %>
    <%= hidden_field_tag "#{param_prefix}[customization_id]", product_customization_type.id %>
    <%= hidden_field_tag "#{param_prefix}[option_id]", product_customization_type.customizable_product_options.second.id %>
    
    <div>                     
      <label for="<%= height_dom_id %>"><%= option.presentation %></label>
	    <%= text_field_tag "#{param_prefix}[option_value]", "",
                         :id => height_dom_id ,:style=>"float: left;", :class=>"customization form-control " %>
    </div>
                 
    <% # the price is stored here on change, and later collected by the product-wide updatePrice() %>
    <%= hidden_field_tag "customization_price", "0", :class => "customization_price" %>
  </div>
<% end %>
{'fraction_non_alphanumeric': 0.1518568928640871, 'fraction_numerical': 0.0019443904335990666, 'mean_word_length': 3.5441696113074204, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 92, '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': '5398839', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1509, 'n_words': 308}