<commit_before><%= javascript_tag do %>

  $(document).ready(function() {

    var default_checkbox = $('#repository_is_default').parent();

    <% if @project.repository.nil? %>
      var content = $('<%= content_tag :p do -%>
        <%= hidden_field_tag "repository[is_default]", "0" -%>
        <%= content_tag :label, l(:field_repository_is_default) -%>
        <%= check_box_tag "repository[is_default]", @repository.is_default, @repository.is_default, disabled: !@repository.new_record? -%>
      <% end -%>');

      content.insertAfter(default_checkbox);
      default_checkbox.remove();
    <% elsif @project.repository == @repository %>
      var content = $('<%= content_tag :p do -%>
        <%= hidden_field_tag "repository[is_default]", "1" -%>
        <%= content_tag :label, l(:field_repository_is_default) -%>
        <%= content_tag :span,  l(:label_yes), :class => 'label label-success' -%>
      <% end -%>');

      content.insertAfter(default_checkbox);
      default_checkbox.remove();
      $('#repository_identifier').parent().remove();
    <% else %>
      var content = $('<%= content_tag :p do -%>
        <%= hidden_field_tag "repository[is_default]", "0" -%>
        <%= content_tag :label, l(:field_repository_is_default) -%><commit_msg>If repo is default, hide identifier input field<commit_after><%= javascript_tag do %>

  $(document).ready(function() {

    // Actually this takes the parent <p> mark
    var default_checkbox = $('#repository_is_default').parent();

    <% if @project.repository.nil? %>
      // Hide identifier input field since is_default is checked
      $('#repository_identifier').parent().hide();

      // Toggle identifier input field if is_default is unchecked
      $('#repository_is_default').on('click', function(){
        $('#repository_identifier').parent().toggle();
      });

    <% elsif @project.repository == @repository %>
      var content = $('<%= content_tag :p do -%>
        <%= hidden_field_tag "repository[is_default]", "1" -%>
        <%= content_tag :label, l(:field_repository_is_default) -%>
        <%= content_tag :span,  l(:label_yes), :class => 'label label-success' -%>
      <% end -%>');

      content.insertAfter(default_checkbox);
      default_checkbox.remove();
      $('#repository_identifier').parent().remove();
    <% else %>
      var content = $('<%= content_tag :p do -%>
        <%= hidden_field_tag "repository[is_default]", "0" -%>
        <%= content_tag :label, l(:field_repository_is_default) -%>
{'fraction_non_alphanumeric': 0.1814194577352472, 'fraction_numerical': 0.001993620414673046, 'mean_word_length': 3.448581560283688, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, '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': '3819959', 'n_tokens_mistral': 795, 'n_tokens_neox': 748, 'n_words': 144}