<% # 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 . %>
  • <% recent_event ||= nil show_context ||= false is_sub_assignment = recent_event.is_a?(SubAssignment) is_assignment_or_sub_assignment = recent_event.is_a?(Assignment) || is_sub_assignment is_calendar_event = recent_event.is_a?(CalendarEvent) if is_assignment_or_sub_assignment if @current_user_submissions submission = @current_user_submissions.detect { |s| s.assignment_id == recent_event.id } submission.assignment = recent_event if submission elsif @current_user submission = @current_user.submissions.select([:id, :assignment_id, :grading_period_id, :score, :grade, :workflow_state, :updated_at]).where(:assignment_id => recent_event).first end recent_event = recent_event.overridden_for(@current_user) end if is_sub_assignment num_replies = recent_event&.parent_assignment&.discussion_topic&.reply_to_entry_required_count || 1 title = if recent_event.sub_assignment_tag == 'reply_to_topic' t('%{title} Reply to Topic', {title: recent_event.title}) else t('%{title} Required Replies (%{num_replies})', {title: recent_event.title, num_replies: num_replies}) end else title = recent_event.title end cache([ 'recent_event_render3', @current_user&.course_nickname_hash, submission || 'no_submission', recent_event || 'blank_event', (recent_event.due_at if is_assignment_or_sub_assignment), Time.zone.today, Time.zone.name, recent_event.context.grants_right?(@current_user, :manage_grades), recent_event.context.grants_right?(@current_user, :participate_as_student) ].cache_key) do icon_explanation, icon_aria_label, icon_class = icon_data(:context => @context, :contexts => @contexts, :current_user => @current_user, :recent_event => recent_event, :submission => submission, :show_assignment_type_icon => true) if is_calendar_event context = recent_event.effective_context else context = recent_event.context end %>
    <%= title %> <% if show_context %>

    <%= context.nickname_for(@current_user, :short_name) %>

    <% end %>

    <% if is_assignment_or_sub_assignment %> <% if submission && readable_grade(submission) && !recent_event.muted? %> <%= readable_grade(submission) %> • <% elsif recent_event.points_possible %> <%= t({one: '1 point', other: '%{count} points'}, count: round_if_whole(recent_event.points_possible)) %> • <% end %> <%= due_at(recent_event, @current_user) %> <% else %> <%= datetime_string(recent_event.start_at) %> <% end %>

    <% end %>