<commit_before>- editable_sites = current_user.all_editable_sites.where(project_id: @project.id)

- if editable_sites.count > 1
  %h1
    Create New Subject on Site

  %p.lead
    A new subject will be created on one of the following sites.

  %p.lead
    Add
    %strong= params[:subject_code]
    to:

  - editable_sites.order(:name).in_groups_of(3, false).each do |sites_row|
    - sites_row.each do |site|
      %div{ style: 'margin-bottom: 20px; margin-left: 20px;' }
        = link_to project_subjects_path(@project, subject: { subject_code: params[:subject_code], acrostic: '' }, site_id: site.id), method: :post, class: 'btn btn-success-inverse' do
          %strong.btn-text-emphasis= site.name

- elsif editable_sites.count == 1
  %h1 Subject Code Not Found

  %p.lead
    Would you like to add
    %strong= params[:subject_code]
    as a new subject?

  = link_to project_subjects_path(@project, subject: { subject_code: params[:subject_code], acrostic: '' }, site_id: editable_sites.first.id), method: :post, class: 'btn btn-success-inverse' do
    Create Subject
    %strong.btn-text-emphasis= params[:subject_code]

- else
  %h1 No Sites on Project

  %p.lead
    You will need to
    = link_to 'add a site', new_project_site_path(@project)
    before creating subjects.
<commit_msg>Added cancel button when accidentally searching for subjects that don't exist<commit_after>- editable_sites = current_user.all_editable_sites.where(project_id: @project.id)

- if editable_sites.count > 1
  %h1
    Create New Subject on Site

  %p.lead
    A new subject will be created on one of the following sites.

  %p.lead
    Add
    %strong= params[:subject_code]
    to:

  - editable_sites.order(:name).in_groups_of(3, false).each do |sites_row|
    - sites_row.each do |site|
      %div{ style: 'margin-bottom: 20px; margin-left: 20px;' }
        = link_to project_subjects_path(@project, subject: { subject_code: params[:subject_code], acrostic: '' }, site_id: site.id), method: :post, class: 'btn btn-success-inverse' do
          %strong.btn-text-emphasis= site.name

  %div{ style: 'margin-bottom: 20px; margin-left: 20px;' }
    = link_to @project, class: 'btn btn-default' do
      Cancel

- elsif editable_sites.count == 1
  %h1 Subject Code Not Found

  %p.lead
    Would you like to add
    %strong= params[:subject_code]
    as a new subject?

  = link_to project_subjects_path(@project, subject: { subject_code: params[:subject_code], acrostic: '' }, site_id: editable_sites.first.id), method: :post, class: 'btn btn-success-inverse' do
    Create Subject
    %strong.btn-text-emphasis= params[:subject_code]

  &nbsp;
  = link_to @project, class: 'btn btn-default' do
    Cancel

- else
  %h1 No Sites on Project

  %p.lead
    You will need to
    = link_to 'add a site', new_project_site_path(@project)
    before creating subjects.

{'fraction_non_alphanumeric': 0.11597757533286615, 'fraction_numerical': 0.008409250175192713, 'mean_word_length': 3.6122778675282716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2752289', 'n_tokens_mistral': 1012, 'n_tokens_neox': 946, 'n_words': 265}