<%= form_for paper do |f| %>
<div class="form-group">
  <%= render partial: "shared/errors", locals: { object: paper } if paper.errors.any? %>
</div>

<%- if paper_types.present? %>
  <div class="form-group">
    <div class="row">
      <div class="col">
        <%= f.label :kind, "Content type" %>
        <%= f.select(:kind, paper_types, {}, class: "form-control") %>
      </div>
      <div class="col">
      </div>
    </div>
  </div>
<%- end %>

<div class="form-group">
  <div class="row">
    <div class="col">
      <%= f.label :title %>
      <%= f.text_field :title, placeholder: "What's the title of this paper?", class: "form-control" %>
    </div>

    <div class="col">
      <label for="repository_url">Software's Git repository URL</label>
      <%= f.text_field :repository_url, placeholder: "e.g. https://github.com/openjournals/joss", class: "form-control" %>
    </div>
  </div>
</div>

<div class="form-group">
  <div class="row">
    <div class="col">
      <%= f.label "Name of git branch containing the paper, not the path" %>
      <%= f.text_field :git_branch, placeholder: "Leave blank if paper.md is in the default branch", class: "form-control" %>
    </div>
    <div class="col">
      <%= f.label "Software Version" %>
      <%= f.text_field :software_version, placeholder: "e.g. v1.0.0", class: "form-control" %>
    </div>
  </div>
</div>

<div class="form-group">
  <div class="row">
    <div class="col">
      <%= f.label "Type of submission" %>
      <%= f.select(:submission_kind, {'New submission' => 'new', 'Resubmission' => 'resubmission', 'Major new version' => 'new version'}, {include_blank: false, prompt: "Select one and explain choice below"}, class: "form-control", style: "margin-right: 12px;") %>
    </div>
    <div class="col" data-controller="autocomplete" data-autocomplete-url-value="<%= search_subjects_path %>">
      <%= f.label "Main subject of the paper" %>
      <%= f.text_field :suggested_subject, placeholder: (JournalFeatures.tracks? ? "Start typing and select the subject that best applies to your paper" : "The subject that best applies to your paper"), class: "form-control", style: "margin-right: 12px;", data: {"autocomplete-target" => "input"} %>
      <%= f.hidden_field :track_id, data: {"autocomplete-target" => "hidden"} %>
      <ul class="list-group subjects-options" data-autocomplete-target="results"></ul>
    </div>
  </div>
</div>

<div class="form-group">
  <%= f.label "Message to editors" %>
  <%= f.text_area :body, rows: "7",
    placeholder: "Has any portion of the submitted work (which includes code and documentation) been published or submitted, or is planned for submission, to another peer-reviewed publication venue? If yes, please describe. Please also give short (1-2 line) description of your #{setting(:product)} including specific notes to the editor if this is a resubmission or a second paper in #{setting(:abbreviation)} about this #{setting(:product)}. Please disclose any potential conflicts of interest, including financial ones.", class: 'form-control' %>
</div>

<div class="form-group">
  <div class="row">
    <div class="col form-check" style="margin-left: 15px;">
      <input type="checkbox" id="author-check" class="pre-check form-check-input">
      <label class="form-check-label" for="author-check">I certify that I am submitting software for which I am a primary author</label>
    </div>
    <div class="col form-check" style="margin-left: 15px;">
      <input type="checkbox" id="paper-check" class="pre-check form-check-input">
      <label class="form-check-label" for="paper-check">I have verified that my paper compiles using one of <a href="https://joss.readthedocs.io/en/latest/paper.html#checking-that-your-paper-compiles" target="_blank">these tools</a>.</label>
    </div>
    <div class="col form-check">
      <input type="checkbox" id="coc-check" class="pre-check form-check-input">
      <label class="form-check-label" for="coc-check">I confirm that I read and will adhere to the <%= setting(:abbreviation) %> <a href="/about#code_of_conduct" target="_blank">code of conduct</a></label>
    </div>
  </div>
</div>
<div class="form-actions">
  <%= submit_tag("Submit paper", class: "btn paper-submit disabled", disabled: "disabled", id: "author-submit") %>
</div>
<% end %>
