<% # Copyright (C) 2011 - 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 . %> <% css_bundle :submission %> <% user_name = params[:hide_student_name] ? t(:anonymous_username, "This Student") : submission_author_name_for(@assessment_request) %> <% show_updated_plagiarism_icons = @context.root_account.feature_enabled?(:new_gradebook_plagiarism_indicator) %> <% provide :page_title do %><%= join_title @assignment.title, t("Submission Preview") %><% end %> <% if @assignment.submission_types == 'discussion_topic' && @assignment.discussion_topic %>

<% if assignment_visible_to_user = @assignment.visible_to_user?(@current_user)%> <% if @assignment.discussion_topic.for_group_discussion? && (group = @assignment.discussion_topic.group_category.group_for(@user)) %> <%= t('group_discussion_submission_description', "The submissions for this assignment are posts in the assignment's discussion for this group. Below are the discussion posts for %{user}, or you can *view the full group discussion*.", :user => user_name, :wrapper => " @assignment.discussion_topic.id, :hide_student_names => params[:hide_student_name], :student_id => @submission.user.id, :headless => 1)}\">\\1") %> <% else %> <%= t('discussion_submission_description', "The submissions for this assignment are posts in the assignment's discussion. Below are the discussion posts for %{user}, or you can *view the full discussion*.", :user => user_name, :wrapper => " params[:hide_student_name], :student_id => @submission.user.id, :headless => 1)}\">\\1") %> <% end %> <% else %> <% if @assignment.discussion_topic.for_group_discussion? && (group = @assignment.discussion_topic.group_category.group_for(@user)) %> <%= t('group_discussion_submission_description_without_link', "The submissions for this assignment are posts in the assignment's discussion for this group. Below are the discussion posts for %{user}.", :user => user_name) %> <% else %> <%= t('discussion_submission_description_without_link', "The submissions for this assignment are posts in the assignment's discussion. Below are the discussion posts for %{user}.", :user => user_name) %> <% end %> <% end %>

<% @entries = @assignment.discussion_topic.discussion_entries.active.for_user(@user) %> <% if @assignment.discussion_topic.for_group_discussion? %> <% @entries = @assignment.discussion_topic.child_topics.map{|t| t.discussion_entries.active.for_user(@user) }.flatten.sort_by{|e| e.created_at} %> <% end %> <% @entries.each do |entry| %> <%= render :partial => 'discussion_topics/entry', :object => entry, :locals => {:out_of_context => true, :skip_sub_entries => true, :link_to_headless => true, :hide_student_names => params[:hide_student_name], :assignment_visible_to_user => assignment_visible_to_user} %> <% end %>
<%= t('show_entire_discussion', 'Show the Entire Discussion') %>
<% elsif @submission.submission_type == "online_url" %>
<% image = @submission.attachment if @submission.processed? %> <%= t('external_url_submission', 'This submission was a URL to an external page.') %> <% if image %> <%= t('entry_with_image', "We've included a snapshot of what the page looked like when it was submitted.") %> <% else %> <%= t('entry_no_image', 'Keep in mind that this page may have changed since the submission originally occurred.') %> <% end %>
<%= link_to @submission.url, @submission.url, class: "not_external" %>
<%= link_to t('view_in_a_new_tab', '(View in a new tab)'), @submission.url, class: "open_in_a_new_tab", target: "_blank" %>
<% if @submission.processed %> <% preview_url = if anonymize_students context_url( @context, :context_assignment_anonymous_submission_url, @assignment.id, @submission.anonymous_id, download: image.id ) else context_url( @context, :context_assignment_submission_url, @assignment.id, @submission.user_id, download: image.id ) end %> <%= t('URL Preview') %> <% end %>
<% elsif @submission.submission_type == "online_text_entry" %> <% js_bundle 'legacy/submissions_show_preview_text' %>
<%= render partial: 'submissions/originality_score', locals: { attachment: nil, show_updated_icons: show_updated_plagiarism_icons } %>
<%= user_content(@submission.body) %>
<% elsif @submission.submission_type == "online_upload" %> <% if @submission.versioned_attachments.empty? %>
<%= t('no_files', 'No files were uploaded for this submission') %>
<% else %> <% @submission.versioned_attachments.each do |attachment| %>
<% preview_url = if anonymize_students context_url( @context, :context_assignment_anonymous_submission_url, @assignment.id, @submission.anonymous_id, download: attachment.id ) else context_url( @context, :context_assignment_submission_url, @assignment.id, @submission.user_id, download: attachment.id ) end %> <%= attachment.display_name %> <%= number_to_human_size(attachment.size) %>
<%= render partial: 'submissions/originality_score', locals: { attachment: attachment, show_updated_icons: show_updated_plagiarism_icons } %>
<% if attachment.crocodoc_available? || attachment.canvadoc.try(:has_annotations?) %> <% preview_document = t('preview_crocodoc_document', 'Preview your submission and view teacher feedback, if available') button_text = t('view_feedback_button', 'View Feedback') %> <% elsif attachment.canvadocable? %> <% preview_document = t('preview_submission', 'Preview your submission') button_text = t('view_preview_button', 'Preview') %> <% end %> <% if attachment.crocodoc_available? || attachment.canvadocable? %> data-tooltip title="<%= preview_document %>" class="modal_preview_link Button--link" role="button" data-attachment_id="<%= attachment.id %>" data-submission_id="<%= @submission.id %>" data-dialog-title="<%= attachment.display_name %>" <%= doc_preview_attributes( attachment, anonymous_instructor_annotations: @anonymous_instructor_annotations, enable_annotations: true, enrollment_type: @enrollment_type, moderated_grading_allow_list: @moderated_grading_allow_list, submission_id: @submission.id ) %> > <%= button_text %> <% end %>
<% end %> <% end %> <% js_bundle 'legacy/submissions_show_preview_upload' %> <% elsif @submission.submission_type == "online_quiz" %>
<%= t('quiz_submission', 'This submission was a quiz submission. Redirecting to quiz page.') %>
<% elsif @submission.submission_type == 'media_recording' && @submission.media_comment_id %> <%= t('media_comment_link', "This submission is a media recording. *click here to view.*", :wrapper => '
\1
') %>
<% js_bundle 'legacy/submissions_show_preview_media' %> <% elsif @submission.submission_type == 'basic_lti_launch' %> <% elsif @submission.has_submission? || @assignment.expects_external_submission? %>
<%= t('no_preview_available', 'No Preview Available') %>
<% else %>
<%= t('no_submission', 'No Submission') %>
<% end %>