<commit_before><%
p = @product
has_options = p.options && p.options.count > 0
may_delete1 = p.variants.collect{|v| v.option1 }.uniq.count == 1
may_delete2 = p.variants.collect{|v| v.option2 }.uniq.count == 1
may_delete3 = p.variants.collect{|v| v.option3 }.uniq.count == 1
%>
<%= render :partial => 'caboose/products/admin_header' %>

<h2>Options</h2>

<p class='note' style='font-size: 85%; font-weight: normal; line-height: 140%;'>
  Product options allow you to present a group of similar products as a single 
  product to the end user.  Common options include color, size, and style.  
  But an option can be anything.  So for example, you could create a "Sleave" option for 
  shirts that are either long or short sleeved.  Or you could create a "Tip" option 
  for chopsticks that are either rounded or squared at the tip.  It's up to you.
</p>

<table>
<tr><td><div id='product_<%= p.id %>_option1'></div></td><td><div id='product_<%= p.id %>_default1'></div></td><td><div id='product_<%= p.id %>_option1_media'></div></td></tr>
<tr><td><div id='product_<%= p.id %>_option2'></div></td><td><div id='product_<%= p.id %>_default2'></div></td><td><div id='product_<%= p.id %>_option2_media'></div></td></tr>
<tr><td><div id='product_<%= p.id %>_option3'></div></td><td><div id='product_<%= p.id %>_default3'></div></td><td><div id='product_<%= p.id %>_option3_media'></div></td></tr>
</table>

<h2>Modifications</h2>

<p class='note' style='font-size: 85%; font-weight: normal; line-height: 140%;'>
  Product modifications are similar to options, but they don't affect the inventory.
  Modifications are things that are done to a product after it has been ordered.
  For example, engraved vs not engraved.
</p>

<div id='mods'></div>
<div id='message'></div>

<%= render :partial => 'caboose/products/admin_footer' %>
<% content_for :caboose_js do %>
<%= javascript_include_tag 'caboose/admin_edit_modifications' %>
<script type='text/javascript'>

var mods_controller = false;
$(document).ready(function() {
  console.log(<%= raw p.option1_media %>);
  console.log(<%= raw p.option2_media %>);
  console.log(<%= raw p.option3_media %>);
  m = new ModelBinder({
    name: 'Product',
    id: <%= p.id %>,
    update_url: '/admin/products/<%= p.id %>',
    authenticity_token: '<%= form_authenticity_token %>',
    attributes: [
      { name: 'option1'       , nice_name: 'Option 1'      , type: 'text'     , value: <%= raw Caboose.json(p.option1)        %>, width: 250, fixed_placeholder: true },                         
      { name: 'option2'       , nice_name: 'Option 2'      , type: 'text'     , value: <%= raw Caboose.json(p.option2)        %>, width: 250, fixed_placeholder: true }, 
      { name: 'option3'       , nice_name: 'Option 3'      , type: 'text'     , value: <%= raw Caboose.json(p.option3)        %>, width: 250, fixed_placeholder: true },            
      { name: 'option1_media' , nice_name: 'Uses Image'    , type: 'checkbox' , value: <%= raw Caboose.json(p.option1_media)  %>, width: 150, fixed_placeholder: true, align: 'right' },                         
      { name: 'option2_media' , nice_name: 'Uses Image'    , type: 'checkbox' , value: <%= raw Caboose.json(p.option2_media)  %>, width: 150, fixed_placeholder: true, align: 'right' }, 
      { name: 'option3_media' , nice_name: 'Uses Image'    , type: 'checkbox' , value: <%= raw Caboose.json(p.option3_media)  %>, width: 150, fixed_placeholder: true, align: 'right' },
      { name: 'default1'      , nice_name: 'Default value' , type: 'text'     , value: <%= raw Caboose.json(p.default1)       %>, width: 285, fixed_placeholder: true },                         
      { name: 'default2'      , nice_name: 'Default value' , type: 'text'     , value: <%= raw Caboose.json(p.default2)       %>, width: 285, fixed_placeholder: true }, 
      { name: 'default3'      , nice_name: 'Default value' , type: 'text'     , value: <%= raw Caboose.json(p.default3)       %>, width: 285, fixed_placeholder: true } 
    ]
  });
  
  mods_controller = new ModificationsController({
    product_id: <%= p.id %>,
    authenticity_token: '<%= form_authenticity_token %>',
  });  
});

</script>
<% end %>
<% content_for :caboose_css do %>
<style type='text/css'>
div.modification { border: #ccc 1px solid; padding: 10px; margin-bottom: 10px; }
</style>
<% end %><commit_msg>More changes<commit_after><%
p = @product
has_options = p.options && p.options.count > 0
may_delete1 = p.variants.collect{|v| v.option1 }.uniq.count == 1
may_delete2 = p.variants.collect{|v| v.option2 }.uniq.count == 1
may_delete3 = p.variants.collect{|v| v.option3 }.uniq.count == 1
%>
<%= render :partial => 'caboose/products/admin_header' %>

<h2>Options</h2>

<p class='note' style='font-size: 85%; font-weight: normal; line-height: 140%;'>
  Product options allow you to present a group of similar products as a single 
  product to the end user.  Common options include color, size, and style.  
  But an option can be anything.  So for example, you could create a "Sleave" option for 
  shirts that are either long or short sleeved.  Or you could create a "Tip" option 
  for chopsticks that are either rounded or squared at the tip.  It's up to you.
</p>

<table>
<tr><td><div id='product_<%= p.id %>_option1'></div></td><td><div id='product_<%= p.id %>_default1'></div></td><td><div id='product_<%= p.id %>_option1_media'></div></td></tr>
<tr><td><div id='product_<%= p.id %>_option2'></div></td><td><div id='product_<%= p.id %>_default2'></div></td><td><div id='product_<%= p.id %>_option2_media'></div></td></tr>
<tr><td><div id='product_<%= p.id %>_option3'></div></td><td><div id='product_<%= p.id %>_default3'></div></td><td><div id='product_<%= p.id %>_option3_media'></div></td></tr>
</table>

<h2>Modifications</h2>

<p class='note' style='font-size: 85%; font-weight: normal; line-height: 140%;'>
  Product modifications are similar to options, but they don't affect the inventory.
  Modifications are things that are done to a product after it has been ordered.
  For example, engraved vs not engraved.
</p>

<div id='mods'></div>
<div id='message'></div>

<%= render :partial => 'caboose/products/admin_footer' %>
<% content_for :caboose_js do %>
<%= javascript_include_tag 'caboose/admin_edit_modifications' %>
<script type='text/javascript'>

var mods_controller = false;
$(document).ready(function() {  
  m = new ModelBinder({
    name: 'Product',
    id: <%= p.id %>,
    update_url: '/admin/products/<%= p.id %>',
    authenticity_token: '<%= form_authenticity_token %>',
    attributes: [
      { name: 'option1'       , nice_name: 'Option 1'      , type: 'text'     , value: <%= raw Caboose.json(p.option1)        %>, width: 250, fixed_placeholder: true },                         
      { name: 'option2'       , nice_name: 'Option 2'      , type: 'text'     , value: <%= raw Caboose.json(p.option2)        %>, width: 250, fixed_placeholder: true }, 
      { name: 'option3'       , nice_name: 'Option 3'      , type: 'text'     , value: <%= raw Caboose.json(p.option3)        %>, width: 250, fixed_placeholder: true },            
      { name: 'option1_media' , nice_name: 'Uses Image'    , type: 'checkbox' , value: <%= raw Caboose.json(p.option1_media)  %>, width: 150, fixed_placeholder: true, align: 'right' },                         
      { name: 'option2_media' , nice_name: 'Uses Image'    , type: 'checkbox' , value: <%= raw Caboose.json(p.option2_media)  %>, width: 150, fixed_placeholder: true, align: 'right' }, 
      { name: 'option3_media' , nice_name: 'Uses Image'    , type: 'checkbox' , value: <%= raw Caboose.json(p.option3_media)  %>, width: 150, fixed_placeholder: true, align: 'right' },
      { name: 'default1'      , nice_name: 'Default value' , type: 'text'     , value: <%= raw Caboose.json(p.default1)       %>, width: 285, fixed_placeholder: true },                         
      { name: 'default2'      , nice_name: 'Default value' , type: 'text'     , value: <%= raw Caboose.json(p.default2)       %>, width: 285, fixed_placeholder: true }, 
      { name: 'default3'      , nice_name: 'Default value' , type: 'text'     , value: <%= raw Caboose.json(p.default3)       %>, width: 285, fixed_placeholder: true } 
    ]
  });
  
  mods_controller = new ModificationsController({
    product_id: <%= p.id %>,
    authenticity_token: '<%= form_authenticity_token %>',
  });  
});

</script>
<% end %>
<% content_for :caboose_css do %>
<style type='text/css'>
div.modification { border: #ccc 1px solid; padding: 10px; margin-bottom: 10px; }
</style>
<% end %>
{'fraction_non_alphanumeric': 0.1817332398972203, 'fraction_numerical': 0.020439149731371176, 'mean_word_length': 3.530687830687831, 'pattern_counts': {'":': 0, '<': 188, '<?xml version=': 0, '>': 194, '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': '5321124', 'n_tokens_mistral': 3159, 'n_tokens_neox': 2908, 'n_words': 748}