<%
# Copyright (C) 2016 - 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/>.
%>

<div class="form">
  <% if @has_student_submissions %>
    <% has_student_submissions_title = t(<<-TEXT)
      Students have either already taken or started taking this quiz, so be careful
      about editing it.  If you change any quiz questions in a significant way, you
      may want to consider regrading students who took the old version of the quiz.
      TEXT
    %>
    <div class="alert alert-info" id="student_submissions_warning">
      <i class="icon-warning"></i><span class="screenreader-only"><%= has_student_submissions_title %></span> <%= has_student_submissions_title %>
    </div>
  <% end %>

  <div style="display: none;" id="quiz_urls">
    <a href="<%= context_url(@context, :context_quiz_url, @quiz.id) %>" class="update_quiz_url">&nbsp;</a>
    <a href="<%= context_url(@context, :context_quiz_quiz_questions_url, @quiz.id) %>" class="add_question_url">&nbsp;</a>
    <a href="<%= context_url(@context, :api_v1_context_quiz_reorder_url, @quiz.id) %>" class="reorder_questions_url">&nbsp;</a>
    <a href="<%= context_url(@context, :context_quiz_quiz_groups_url, @quiz.id) %>" class="add_group_url">&nbsp;</a>
  </div>
  <div class="header-bar">
    <%= render :partial => 'quiz_edit_header' %>
  </div>
  <div id="quiz_tabs" class="ui-tabs-minimal">
    <ul id="quiz_tabs_tab_list">
      <li><a href="#options_tab"><%= t('Details') %></a></li>
      <li><a href="#questions_tab"><%= t('Questions') %></a></li>
      <% if ConditionalRelease::Service.enabled_in_context?(@context) then %>
        <li><a href="#mastery-paths-editor"><%= t('Mastery Paths') %></a></li>
      <% end %>
    </ul>
    <%= render :partial => 'quiz_edit_details' %>
    <%= render :partial => 'quiz_edit_questions' %>
    <% if ConditionalRelease::Service.enabled_in_context?(@context) then %>
      <%= render :partial => 'quiz_edit_conditional_release' %>
    <% end %>
  </div>
  <%= render :partial => 'quiz_edit_form_actions' %>
</div>
