%
# Copyright (C) 2013 - 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 .
%>
<%
module_item_next ||= nil
module_item ||= module_item_next
item_data ||= { published_status: 'unpublished' }
completion_criteria ||= nil
editable ||= false
can_direct_share = can_do(@context, @current_user, :read_as_admin) && @domain_root_account&.feature_enabled?(:direct_share)
criterion = completion_criteria && completion_criteria.find{|c| c[:id] == module_item.id}
@module_item_image_tags ||= {
'indent' => "".html_safe,
'outdent' => "".html_safe,
'edit' => "".html_safe,
'delete' => "".html_safe,
'duplicate' => "".html_safe,
'copy_to' => "".html_safe,
'send_to' => "".html_safe,
}
menu_type_to_class = {
:assignment_menu => Assignment,
:discussion_topic_menu => DiscussionTopic,
:file_menu => Attachment,
:quiz_menu => Quizzes::Quiz,
:wiki_page_menu => WikiPage
}
%>
"
style="<%= hidden unless module_item %>"
class="
context_module_item
<%= 'student-view' if @is_student %>
<% if module_item&.content&.respond_to?("can_duplicate?") %>
<%= 'cannot-duplicate' if !module_item&.content&.can_duplicate?%>
<% end %>
<%= module_item.content_type_class(@is_student) if module_item %>
<%= 'also_assignment' if module_item && module_item.graded? %>
indent_<%= module_item.try_rescue(:indent) || '0' %>
<%= 'progression_requirement' if criterion %>
<%= criterion[:type] if criterion %>_requirement
<%= module_item.item_class if module_item %>
<%= 'dupeable' if module_item&.duplicate_able? %>
"
>
<% if module_item && module_item.content_type != 'ContextModuleSubHeader' %>
">
<%= module_item && module_item.title %>
<% end %>
<% if editable || module_item.nil? %>
<% end %>
<%= module_item_translated_content_type(module_item, @is_student) %>
<%= (criterion && criterion[:min_score]) || nbsp %>
<%= (criterion && criterion[:type]) || nbsp %>
<%= module_item ? module_item.content_type_class : nbsp %>
<%= module_item ? module_item.id : nbsp %>
<%= module_item && module_item.graded? ? '1' : '0' %>
<% score_display = content_tag(:span, criterion && criterion[:min_score] || nbsp, class: 'min_score') %>
<%= t 'min_score.unfulfilled', 'Score at least %{score}', :score => score_display %>
<%= t 'Must score at least %{score} to complete this module item', :score => score_display %>
<%= t 'min_score.fulfilled', 'Scored at least %{score}', :score => score_display %>
<%= t 'Module item has been completed by scoring at least %{score}', :score => score_display %>
<%= t('View') %>
<%= t('Must view in order to complete this module item') %>
<%= t('Viewed') %>
<%= t('Module item has been viewed and is complete') %>
<%= t 'Mark done' %>
<%= t 'Must mark this module item done in order to complete' %>
<%= t 'Marked done' %>
<%= t 'Module item marked as done and is complete' %>
<%= t('must_contribute.unfulfilled', 'Contribute') %>
<%= t('Must contribute to this module item to complete it') %>
<%= t('must_contribute.fulfilled', "Contributed") %>
<%= t('Contributed to this module item and is complete') %>
<%= t('must_submit.unfulfilled', 'Submit') %>
<%= t('Must submit this module item to complete it') %>
<%= t('must_submit.fulfilled', 'Submitted') %>
<%= t('Module item submitted and is complete') %>
<% if !editable %>
<%# going to set this in JS-land, not here %>
<% end %>
<% if editable || module_item.nil? || can_direct_share && module_item.direct_shareable? %>
<% if editable || module_item.nil? %>
<% end %>
<% end %>