index.mustache 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <%
  19. title = @context.is_a?(Course) ? t('content_exports', "Content Exports") : t('user_data_exports', "Download Submissions")
  20. friendly_message = @context.is_a?(Course) ? nil : t("Creating a Submission Export will allow you to download a zip file of all your assignment submissions in all of your present and past courses. This could be a big file, so it may take a while. You can navigate away from the page and come back later.")
  21. %>
  22. <% add_crumb title %>
  23. <% content_for :page_title do %><%= title %><% end %>
  24. <div>
  25. <h1><%= title %></h1>
  26. <% if friendly_message %>
  27. <p><%= friendly_message %></p>
  28. <% end %>
  29. <div class="export_messages" style="<%= hidden %>">
  30. <div class="alert-error error_message"></div>
  31. </div>
  32. <hr />
  33. <div id="export_files">
  34. <% @exports.each do |export| %>
  35. <% unless export.running? %>
  36. <% if export.workflow_state == 'exported' %>
  37. <p>
  38. <% date = "<span class=\"created_at time_ago_date\" data-timestamp=\"#{export.created_at.iso8601}\">#{datetime_string export.created_at}</span>".html_safe %>
  39. <% wrapper = link_to('\1', export.attachment ? verified_file_download_url(export.attachment) : nil) %>
  40. <% if export.expired? %>
  41. <%= t "Course Export from %{date} (file not available)", :date => date %>
  42. <% elsif export.export_type == ContentExport::COMMON_CARTRIDGE %>
  43. <%= t 'links.download', "Course Export from %{date}: *Click here to download*", :date => date, :wrapper => wrapper %>
  44. <% elsif export.export_type == ContentExport::QTI %>
  45. <%= t 'links.download_qti', "QTI Export from %{date}: *Click here to download*", :date => date, :wrapper => wrapper %>
  46. <% elsif export.export_type == ContentExport::USER_DATA %>
  47. <%= t 'links.download_user_export', "User Data Export from %{date}: *Click here to download*", :date => date, :wrapper => wrapper %>
  48. <% elsif export.export_type == ContentExport::ZIP %>
  49. <%= t 'links.download_file_export', "File Export from %{date}: *Click here to download*", :date => date, :wrapper => wrapper %>
  50. <% end %>
  51. </p>
  52. <% end %>
  53. <% end %>
  54. <% end %>
  55. </div>
  56. <% if ContentExport.expire? %>
  57. <p><em><%= t "Content export files cannot be downloaded after %{days} days.", days: ContentExport.expire_days %></em></p>
  58. <% end %>
  59. <hr />
  60. <div class="form" style="<%= hidden if @current_export_id %>">
  61. <% if @context.is_a?(Course) %>
  62. <%= form_tag course_content_exports_path(@context.id), :id => "exporter_form" do %>
  63. <fieldset>
  64. <h2><%= t :export_type, "Export Type" %></h2>
  65. <div>
  66. <input type="radio" name="export_type" value="common_cartridge" id="cc_export_radio" checked>
  67. <label for="cc_export_radio"><%= t 'labels.course', 'Course' %></label>
  68. </div>
  69. <div>
  70. <input type="radio" name="export_type" value="qti" id="qti_export_radio">
  71. <label for="qti_export_radio"><%= t 'labels.quiz', 'Quiz' %></label>
  72. <div id="quiz_selection" style="display:none;">
  73. {{> views/quiz_export_checklist}}
  74. </div>
  75. </div>
  76. </fieldset>
  77. <div>
  78. <button type="submit" class="submit_button btn btn-primary"><%= t 'buttons.create', "Create Export" %></button>
  79. </div>
  80. <div class="clear"></div>
  81. <% end %>
  82. <% elsif @context == @current_user %>
  83. <% if @current_user.submissions.exists? %>
  84. <%= form_tag dashboard_content_exports_path, :id => "exporter_form" do %>
  85. <div>
  86. <button type="submit" class="submit_button btn btn-primary"><%= t 'buttons.create', "Create Export" %></button>
  87. </div>
  88. <div class="clear"></div>
  89. <% end %>
  90. <% else %>
  91. {{#t}}You currently have no submissions to export.{{/t}}
  92. <% end %>
  93. <% end %>
  94. </div>
  95. <div class="progress_bar_holder" style="<%= hidden unless @current_export_id %> margin-top: 10px;">
  96. <div class="export_progress"></div>
  97. <% if @context.is_a?(Course) %>
  98. <div class="progress_message">
  99. <%= mt 'message.export_started', "The export process has started. This can take awhile for large courses. *You can leave the page* and you'll get an email when the export is complete." %>
  100. </div>
  101. <% end %>
  102. </div>
  103. <% if @current_export_id %>
  104. <div id="current_export_id" style="<%= hidden %>"><%= @current_export_id %></div>
  105. <% end %>
  106. </div>
  107. <% js_bundle :content_exports %>