<%
# Copyright (C) 2018 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%= form_tag(context_url(@context, :controller => :submissions, :assignment_id => @assignment.id, :action => :create), {:id => "submit_online_text_entry_form", :class => "submit_assignment_form"}) do %>
    <%= hidden_field :submission, :submission_type, :value => "online_text_entry" %>
    <%= hidden_field :submission, :eula_agreement_timestamp, :id => "eula_agreement_timestamp" %>
    <table class="formtable" style="width: 100%;">
      <tr>
        <td>
        <%= t 'instructions.online_text_entry', "Copy and paste or type your submission right here." %>
            <%= render :partial => "assignments/group_submission_reminder" if @assignment.has_group_category? %>
        </td>
      </tr><tr>
        <td>
          <% unless @context.feature_enabled?(:rce_enhancements) %>
            <div style="text-align: <%= direction('right') %>; font-size: 0.8em;">
              <a class="switch_text_entry_submission_views" href="#"><%= t '#editor.switch_editor_html', "HTML Editor" %></a>
              <a class="switch_text_entry_submission_views" href="#" style="display:none"><%= t '#editor.switch_editor_rich_text', "Rich Content Editor" %></a>
            </div>
          <% end %>
          <%= text_area :submission, :body, :style => "width: 100%; height: 250px;" %>
        </td>
      </tr><tr>
        <td>
          <%= text_area :submission, :comment, :class => 'submission_comment_textarea', :placeholder => t('comments_placeholder', 'Comments...'), :title => t('additional_comments', 'Additional comments') %>
        </td>
      </tr>
      <%= render :partial => "group_comment" %>
      <% if @assignment.turnitin_enabled? %>
        <%= render :partial => "turnitin" %>
      <% end %>
      <% if @assignment.vericite_enabled? %>
        <%= render :partial => "vericite" %>
      <% end %>
      <%= render partial: 'assignments/eula_checkbox', locals: { eula_url: eula_url } %>
      <tr>
        <td class='button-container'>
          <button type="button" class='cancel_button btn'><%= t '#buttons.cancel', "Cancel" %></button>
          <button type="submit" class="btn btn-primary"><%= t 'buttons.submit_assignment', "Submit Assignment" %></button>
        </td>
      </tr>
    </table>
    <% end %>