<% # 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 . %> <% presenter = Submission::ShowPresenter.new( submission: @submission, current_user: @current_user, assessment_request: @assessment_request, current_host: request.host ) # Calls to doc_preview_attributes will result in this hash getting some # attributes deleted; dup this hash before passing it to any methods. preview_url_opts = { 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 } if @submission.submission_type == "student_annotation" annotation_context = @submission.annotation_context(attempt: @submission.attempt) preview_url_opts[:annotation_context] = annotation_context.launch_id end show_full_discussion_immediately = @context.root_account.feature_enabled?(:discussion_checkpoints) %> <% 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 %> <% @entries = @assignment.discussion_topic.for_group_discussion? ? @assignment.discussion_topic.all_child_entries_from_user(@user) : @assignment.discussion_topic.discussion_entries.active.for_user(@user) hidden_user_id = params[:hide_student_name] ? @user.id : nil url_opts = { embed: true, hidden_user_id:, persist: 1, student_id: @user.id, } if params[:entry_id] || @entries&.first url_opts[:entry_id] = params[:entry_id] || @entries.first.id end topic_to_show = @assignment.discussion_topic.for_group_discussion? ? @assignment.discussion_topic.child_topic_for(@user) : @assignment.discussion_topic topic_to_show ||= @assignment.discussion_topic discussion_iframe_src = context_url(topic_to_show.context, :context_discussion_topic_url, topic_to_show.id, url_opts) %> <% unless show_full_discussion_immediately %>

<% 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, :embed => true)}\">\\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, # legacy discussions uses headless, hide student name, and student id, while discussions redesign uses embed :wrapper => " params[:hide_student_name], :student_id => @submission.user.id, :headless => 1, :embed => true)}\">\\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.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') %>
<% else %>
<% elsif @submission.has_submission? || @assignment.expects_external_submission? %>
<%= t('no_preview_available', 'No Preview Available') %>
<% else %>
<%= t('no_submission', 'No Submission') %>
<% end %>