<commit_before><%= f.inputs do %>
  <%= f.input :title %>
  <%= f.input :introduction %>
<% end %>

<div id="parts">
  <h3>Parts</h3>

  <% setup_association(f.object, :parts, :new => 3, :edit => 3) %>

  <%= f.semantic_fields_for :parts do |part| %>
    <%= render :partial => 'part', :locals => {:f => part} %>
  <% end %>

</div>

<p><a href="#" class="add-associated" data-target="parts" data-tmpl_id="tmpl-parts">+ Part</a></p>
  
<%= f.buttons %>

<%= f.add_associated_jquery_template :parts %>

<style type="text/css" media="screen">
  #parts fieldset {
    border: 1px solid #ccc;
    padding: 0.5em;
    margin: 0.5em;
  }
</style>

<script type="text/javascript" charset="utf-8">
  var formtastic_ids = {};
  
  $(document).ready(function () {
    $('.add-associated').click(function () {
      elem = $(this);
      var target_id = elem.data('target');
      var target = $('#' + target_id);
      
      var template_id = elem.data('tmpl_id');
      template_contents = $('#' + template_id).html();
      
      if (typeof(formtastic_ids[template_id]) == 'undefined') {
        var current_id = target.find('fieldset:last-child input').attr('id').match(/_attributes_(\d+)_/)[1];
        formtastic_ids[template_id] = current_id;
      }

      formtastic_ids[template_id]++;
      
      var html = $.mustache(template_contents, {
        index: formtastic_ids[template_id]
      });
      
      target.append(html);
      return false;
    })
  })
</script><commit_msg>Added button class to make things more button-y<commit_after><%= f.inputs do %>
  <%= f.input :title %>
  <%= f.input :introduction %>
<% end %>

<div id="parts">
  <h3>Parts</h3>

  <% setup_association(f.object, :parts, :new => 3, :edit => 3) %>

  <%= f.semantic_fields_for :parts do |part| %>
    <%= render :partial => 'part', :locals => {:f => part} %>
  <% end %>

</div>

<p class="button"><a href="#" class="add-associated" data-target="parts" data-tmpl_id="tmpl-parts">+ Part</a></p>

<%= f.buttons %>

<%= f.add_associated_jquery_template :parts %>

<style type="text/css" media="screen">
  #parts fieldset {
    border: 1px solid #ccc;
    padding: 0.5em;
    margin: 0.5em;
  }
</style>

<script type="text/javascript" charset="utf-8">
  var formtastic_ids = {};

  $(document).ready(function () {
    $('.add-associated').click(function () {
      elem = $(this);
      var target_id = elem.data('target');
      var target = $('#' + target_id);

      var template_id = elem.data('tmpl_id');
      template_contents = $('#' + template_id).html();

      if (typeof(formtastic_ids[template_id]) == 'undefined') {
        var current_id = target.find('fieldset:last-child input').attr('id').match(/_attributes_(\d+)_/)[1];
        formtastic_ids[template_id] = current_id;
      }

      formtastic_ids[template_id]++;

      var html = $.mustache(template_contents, {
        index: formtastic_ids[template_id]
      });

      target.append(html);
      return false;
    })
  })
</script>
{'fraction_non_alphanumeric': 0.2008704385671242, 'fraction_numerical': 0.007365249414127887, 'mean_word_length': 3.2084507042253523, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 57, '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': '6189450', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1040, 'n_words': 189}