crowdAI/crowdai

View on GitHub
app/views/submissions/new/_form.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
  <% if @challenge.completed? %>
    <br/>
    <p>This challenge is now completed. You may continue to make submissions and your entries will appear on the Ongoing Leaderboard.</p>
  <% end %>
  <%= form_for [@challenge,@submission],
        html: {
          class: "directUpload dbl-col",
          multipart: true },
        data: {
          'form-data' => (@s3_direct_post.fields),
          'url' => @s3_direct_post.url,
          'host' => URI.parse(@s3_direct_post.url).host } do |f| %>

      <% if @challenge.submission_instructions.present? %>
        <label>
          <%= @challenge.submission_instructions.html_safe %>
        </label>
      <% end %>

      <label>Submission description</label>
      <%= markdown_editor do |m| %>
        <%= f.text_area :description_markdown, class: "txt-med" %>
      <% end %>

      <% if @challenge.license.present? %>
        <p class="margin-bottom">
          <%= @challenge.license.html_safe %>
        </p>
      <% else %>
        <p class="margin-bottom">
            After the end of the challenge, these comments will be made public, and the submitted code and models will be freely available to other crowdAI participants. All submitted content will be licensed under Creative Commons (CC).<br>
              By making your submission you indicate your agreement with these terms.
            </p>
        <% end %>
        <%= f.fields_for :submission_files do |f| %>

          <div class="nested-fields">
            <p><%#= @challenge.submission_file_definitions[file.index].submission_file_help_text %></p>
            <%= f.hidden_field :seq %><!-- populated by controller -->
            <%= f.file_field :submission_file_s3_key,
                  as: :file,
                  label: "Submissions file",
                  class: 'file-upload s3File' %>
          </div>
        <% end %>
        <% if @challenge.running? %>
          <p class="margin-bottom">
            <% if @reset_dttm %>
              <strong>You have <%= pluralize(@submissions_remaining,'submission') %> remaining until <%= @reset_dttm %>.</strong>
            <% else %>
              <strong>You have <%= pluralize(@submissions_remaining,'submission') %> remaining.</strong>
            <% end %>
          </p>
        <% end %>

        <div class="button-group">
          <%#= f.button "Submit Entry", class: 'btn btn-primary' %>
          <%#= button_to challenge_path(@challenge),
                class: "btn btn-secondary" do %>
              <%# end %>
        </div>

    <% end %>
  </div>