<commit_before>= form_for @repository, :url => @url, :html => { :id => 'repository-form' } do |f|
  = f.error_messages
  %div
    %label{:for => "url"} Repository URL:
    = f.text_field :url, {:placeholder => '', :autocapitalize => 'off', :autocorrect => 'off', :spellcheck => 'false'}
  - if @repository.test_command.present?
    %div{ title: 'Test command should now be specified in the kochiku.yml' }
      %label{:for => "test_command"} Test Command: (Deprecated)
      = f.text_field :test_command, {:id => 'test_command', :disabled => true}
  %div
    %label{:for => "timeout"} Timeout a build part after:
    = f.text_field :timeout, {:id => "timeout"}
    minutes
  %div
    %label{:for => "run_ci"} Trigger build on push to master:
    = f.check_box :run_ci, {:id => "run_ci"}


  %fieldset
    %legend Pull Requests
    %div
      %label{:for => "build_pull_requests"} Build pull requests:
      = f.check_box :build_pull_requests, {:id => "build_pull_requests"}
    %div
      %label{:for => "allows_kochiku_merges"} Allow developers to request branches be merged into master on success:
      = f.check_box :allows_kochiku_merges, {:id => "allows_kochiku_merges"}

      - display_css = @repository.allows_kochiku_merges ? '' : 'display: none'
      %span{:id => 'branch-delete-warning', :style => display_css} Warning: Kochiku will delete the branch from Git after merging.
    %div
      %label{:for => "send_merge_successful_email"} Send email on automatic merge success:
      = f.check_box :send_merge_successful_email, {:id => "send_merge_successful_email", :disabled => @repository.allows_kochiku_merges ? nil : true}

  %fieldset
    %legend On a green build
    %div
      %label{:for => "on_green_update"} Update branches to last green commit:
      = f.text_field :on_green_update, {:id => "on_green_update", :placeholder => "Comma separated list of branches"}
    %div
      %label{:for => "send_build_success_email"} Send email to contributers:
      = f.check_box :send_build_success_email, {:id => "send_build_success_email"}

  %fieldset
    %legend On a red build
    %div
      %label{:for => "send_build_failure_email"} Send email to build breakers:
      = f.check_box :send_build_failure_email, {:id => "send_build_failure_email"}
    %div
      %label{:for => "email_on_first_failure"} Email on first build part failure:
      = f.check_box :email_on_first_failure, {:id => "email_on_first_failure"}

  = f.submit @repository.new_record? ? "Create" : "Update"

- unless @repository.new_record?
  = button_to "Delete", @repository, method: :delete, form_class: "delete-form", class: "danger-button", data: {confirm: "This is a permanent destructive action, are you sure?"}

= content_for :javascript do
  :javascript
    $('#allows_kochiku_merges').change(function(){
      $('#branch-delete-warning').toggle($("#allows_kochiku_merges").is(':checked'));
    });<commit_msg>Dynamically disable the send_merge_successful_email checkbox<commit_after>= form_for @repository, :url => @url, :html => { :id => 'repository-form' } do |f|
  = f.error_messages
  %div
    %label{:for => "url"} Repository URL:
    = f.text_field :url, {:placeholder => '', :autocapitalize => 'off', :autocorrect => 'off', :spellcheck => 'false'}
  - if @repository.test_command.present?
    %div{ title: 'Test command should now be specified in the kochiku.yml' }
      %label{:for => "test_command"} Test Command: (Deprecated)
      = f.text_field :test_command, {:id => 'test_command', :disabled => true}
  %div
    %label{:for => "timeout"} Timeout a build part after:
    = f.text_field :timeout, {:id => "timeout"}
    minutes
  %div
    %label{:for => "run_ci"} Trigger build on push to master:
    = f.check_box :run_ci, {:id => "run_ci"}


  %fieldset
    %legend Pull Requests
    %div
      %label{:for => "build_pull_requests"} Build pull requests:
      = f.check_box :build_pull_requests, {:id => "build_pull_requests"}
    %div
      %label{:for => "allows_kochiku_merges"} Allow developers to request branches be merged into master on success:
      = f.check_box :allows_kochiku_merges, {:id => "allows_kochiku_merges"}

      - display_css = @repository.allows_kochiku_merges ? '' : 'display: none'
      %span{:id => 'branch-delete-warning', :style => display_css} Warning: Kochiku will delete the branch from Git after merging.
    %div
      %label{:for => "send_merge_successful_email"} Send email on automatic merge success:
      = f.check_box :send_merge_successful_email, {:id => "send_merge_successful_email", :disabled => @repository.allows_kochiku_merges ? nil : true}

  %fieldset
    %legend On a green build
    %div
      %label{:for => "on_green_update"} Update branches to last green commit:
      = f.text_field :on_green_update, {:id => "on_green_update", :placeholder => "Comma separated list of branches"}
    %div
      %label{:for => "send_build_success_email"} Send email to contributers:
      = f.check_box :send_build_success_email, {:id => "send_build_success_email"}

  %fieldset
    %legend On a red build
    %div
      %label{:for => "send_build_failure_email"} Send email to build breakers:
      = f.check_box :send_build_failure_email, {:id => "send_build_failure_email"}
    %div
      %label{:for => "email_on_first_failure"} Email on first build part failure:
      = f.check_box :email_on_first_failure, {:id => "email_on_first_failure"}

  = f.submit @repository.new_record? ? "Create" : "Update"

- unless @repository.new_record?
  = button_to "Delete", @repository, method: :delete, form_class: "delete-form", class: "danger-button", data: {confirm: "This is a permanent destructive action, are you sure?"}

= content_for :javascript do
  :javascript
    $('#allows_kochiku_merges').change(function(){
      $('#branch-delete-warning').toggle($("#allows_kochiku_merges").is(':checked'));
      $('#send_merge_successful_email').prop("disabled", !$("#allows_kochiku_merges").is(':checked'));
    });
    $('#repository-form').submit(function(event) {
      // Manually update the hidden element generated by the Rails check_box helper.
      //
      // This workaround is neccessary for send_merge_successful_email to
      // maintain it's value when its input is is 'disabled'.
      $("input[name='repository[send_merge_successful_email]'][type='hidden']").val(
        $("input[name='repository[send_merge_successful_email]'][type='checkbox']").is(':checked')
      );
    });
{'fraction_non_alphanumeric': 0.14613713931120073, 'fraction_numerical': 0.0, 'mean_word_length': 4.190821256038648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 69, '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': '4724210', 'n_tokens_mistral': 2116, 'n_tokens_neox': 2064, 'n_words': 518}