123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <%
- # 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 <http://www.gnu.org/licenses/>.
- %>
- <%
- module_item_next ||= nil
- module_item ||= module_item_next
- item_data ||= { published_status: 'unpublished' }
- completion_criteria ||= nil
- editable ||= false
- criterion = completion_criteria && completion_criteria.find{|c| c[:id] == module_item.id}
- @module_item_image_tags ||= {
- 'indent' => "<i class='icon-arrow-right'></i>".html_safe,
- 'outdent' => "<i class='icon-arrow-left'></i>".html_safe,
- 'edit' => "<i class='icon-edit'></i>".html_safe,
- 'delete' => "<i class='icon-end'></i>".html_safe,
- 'duplicate' => "<i class='icon-copy-course'></i>".html_safe,
- }
- menu_type_to_class = {
- :assignment_menu => Assignment,
- :discussion_topic_menu => DiscussionTopic,
- :file_menu => Attachment,
- :quiz_menu => Quizzes::Quiz,
- :wiki_page_menu => WikiPage
- }
- %>
- <li
- id="context_module_item_<%= module_item ? module_item.id : "blank" %>"
- style="<%= hidden unless module_item %>"
- class="
- context_module_item
- <%= 'student-view' if @is_student %>
- <%= module_item.content_type_class 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? %>
- "
- >
- <div class="ig-row <%= 'with-completion-requirements' if criterion %> <%= 'ig-published' if module_item && module_item.published? %> <%= 'student-view' if @is_student %>">
- <a
- aria-label='<%= module_item && module_item.title %>'
- tabindex="-1"
- class="for-nvda"
- href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>">
- <%= module_item && module_item.title %>
- </a>
- <% if editable || module_item.nil? %>
- <div aria-hidden="true" class="ig-handle">
- <span
- class="draggable-handle move_item_link"
- title="{{#t}}Drag to reorder or move item to another module{{/t}}"
- >
- <i class="icon-drag-handle" aria-hidden="true"></i>
- </span>
- </div>
- <% end %>
- <span class="type_icon" title="<%= module_item_translated_content_type(module_item) %>">
- <span class="ig-type-icon">
- <i class="icon-document" aria-label="{{#t}}Item type: Document{{/t}}"></i>
- <i class="icon-download" aria-label="{{#t}}Item type: Download{{/t}}"></i>
- <i class="icon-discussion" aria-label="{{#t}}Item type: Discussion{{/t}}"></i>
- <i class="icon-assignment" aria-label="{{#t}}Item type: Assignment{{/t}}"></i>
- <i class="icon-quiz" aria-label="{{#t}}Item type: Quiz{{/t}}"></i>
- <i class="icon-link" aria-label="{{#t}}Item type: Link{{/t}}"></i>
- </span>
- </span>
- <div class="ig-info">
- <div class="module-item-title">
- <span class="item_name">
- <% if module_item && module_item.content_type == 'ExternalUrl' && module_item.new_tab %>
- <a
- title="<%= module_item && module_item.title %>"
- class="title external_url_link"
- target="_blank"
- href="<%= module_item.url %>"
- data-item-href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item.id %>"
- >
- <%= module_item.title %>
- </a>
- <% else %>
- <a
- title="<%= module_item && module_item.title %>"
- class="ig-title title"
- href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>"
- <% if item_data[:mastery_paths] && item_data[:mastery_paths][:locked] %>
- aria-describedby="module-item-locked-<%= module_item && module_item.id %>"
- <% end %>
- >
- <%= module_item && module_item.title %>
- </a>
- <% end %>
- <span title="<%= module_item && module_item.title %>" class="title locked_title"><%= module_item && module_item.title %></span>
- <span class="points_possible" style="display: none;"><%= round_if_whole(module_item.try_rescue(:assignment).try_rescue(:points_possible)) || nbsp %></span>
- <span class="requirement" style="display: none;"> </span>
- <span class="completion_requirement" style="display: none;"> </span>
- <span class="position" style="display: none;"><%= module_item && module_item.position %></span>
- <span class="url" style="display: none;"><%= module_item.try(:url) if editable %></span>
- <span class="new_tab" style="display: none;"><%= module_item.try(:new_tab) ? '1' : '0' if editable %></span>
- </span>
- </div>
- <div class="module_item_icons nobr">
- <!-- dead code? -->
- <span class="criterion <%= 'defined' if criterion %>">
- <span class="min_score" style="display: none;"><%= (criterion && criterion[:min_score]) || nbsp %></span>
- <span class="criterion_type" style="display: none;"><%= (criterion && criterion[:type]) || nbsp %></span>
- </span>
- <!-- /dead code -->
- <span class="type" style="display: none;"><%= module_item ? module_item.content_type_class : nbsp %></span>
- <span class="id" style="display: none;"><%= module_item ? module_item.id : nbsp %></span>
- <span class="graded" style="display: none;"><%= module_item && module_item.graded? ? '1' : '0' %></span>
- </div>
- <div class="ig-details">
- <div class="due_date_display ig-details__item"></div>
- <div class="points_possible_display ig-details__item"></div>
- <div class="requirement-description ig-details__item">
- <span class="completion_requirement">
- <span class="requirement_type min_score_requirement">
- <% score_display = content_tag(:span, criterion && criterion[:min_score] || nbsp, class: 'min_score') %>
- <span class="unfulfilled">
- <%= t 'min_score.unfulfilled', 'Score at least %{score}', :score => score_display %>
-
- </span>
- <span class="fulfilled">
- <%= t 'min_score.fulfilled', 'Scored at least %{score}', :score => score_display %>
-
- </span>
- </span>
- <span class="requirement_type must_view_requirement">
- <span class="unfulfilled">
- {{#t}}View{{/t}}
-
- </span>
- <span class="fulfilled">
- {{#t}}Viewed{{/t}}
-
- </span>
- </span>
- <span class="requirement_type must_mark_done_requirement">
- <span class="unfulfilled">
- <%= t 'Mark done' %>
-
- </span>
- <span class="fulfilled">
- <%= t 'Marked done' %>
-
- </span>
- </span>
- <span class="requirement_type must_contribute_requirement">
- <span class="unfulfilled">
- {{#t}}Contribute{{/t}}
-
- </span>
- <span class="fulfilled">
- {{#t}}Contributed{{/t}}
-
- </span>
- </span>
- <span class="requirement_type must_submit_requirement">
- <span class="unfulfilled">
- {{#t}}Submit{{/t}}
-
- </span>
- <span class="fulfilled">
- {{#t}}Submitted{{/t}}
-
- </span>
- </span>
- </span>
- </div> <!-- requirement description end -->
- </div>
- </div>
- <% if !editable %>
- <div class="module-item-status-icon"></div> <%# going to set this in JS-land, not here %>
- <% end %>
- <% if editable || module_item.nil? %>
- <div class="ig-admin">
- <span
- data-module-item-id="<%= module_item && module_item.id %>"
- data-module-type="<%= module_item && module_item.content_type_class %>"
- data-content-id="<%= module_item && module_item.content_id %>"
- class="lock-icon"
- >
- </span>
- <span
- data-module-item-name="<%= module_item && module_item.title %>"
- data-module-type="<%= module_item && module_item.content_type_class %>"
- data-content-id="<%= module_item && module_item.content_id %>"
- data-id="<%= module_item_publishable_id(module_item) %>"
- data-course-id="<%= module_item && module_item.context_id %>"
- data-module-id="<%= module_item && module_item.context_module_id %>"
- data-module-item-id="<%= module_item && module_item.id %>"
- data-assignment-id="<%= module_item && module_item.assignment.try(:id) %>"
- data-is-cyoeable="<%= module_item && cyoe_able?(module_item) %>"
- data-published="<%= module_item && item_data[:published_status] == 'published' %>"
- data-publishable="<%= module_item_publishable?(module_item) %>"
- data-unpublishable="<%= module_item_unpublishable?(module_item) %>"
- data-publish-title="<%= module_item && module_item.title ? module_item.title : '' %>"
- title=""
- data-tooltip
- class="publish-icon <%= item_data[:published_status] %>"
- >
- <i class="icon-<%= item_data[:published_status] %>"></i>
- </span>
- <div class="inline-block cog-menu-container">
- <a class="al-trigger al-trigger-gray" role="button" tabindex="0" href="#">
- <i class="icon-settings"></i><i class="icon-mini-arrow-down"></i>
-
- </a>
- <ul class="al-options">
- <li role="presentation"><a href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>" class="outdent_item_link" title="{{#t}}Decrease indent') %>"><%= @module_item_image_tags['outdent'] %> <%= t('Decrease indent{{/t}}</a></li>
- <li role="presentation"><a href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>" class="indent_item_link" title="{{#t}}Increase indent') %>"><%= @module_item_image_tags['indent'] %> <%= t('Increase indent{{/t}}</a></li>
- <li role="presentation"><a href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>" class="edit_item_link edit_link" title="{{#t}}Edit item details') %>"><%= @module_item_image_tags['edit'] %> <%= t('Edit{{/t}}</a></li>
- <li class="dupe-option" role="presentation"><a href="/api/v1<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>/duplicate" class="duplicate_item_link" title="{{#t}}Duplicate Item') %>"><%= @module_item_image_tags['duplicate'] %> <%= t('Duplicate{{/t}}</a></li>
- <li role="presentation">
- <a href="#<%= module_item ? module_item.id : "{{ id }}" %>"
- aria-label="{{#t}}Move this item{{/t}}"
- class="move_module_item_link icon-updown"
- title="{{#t}}Move this item{{/t}}"
- >{{#t}}Move to...{{/t}}</a>
- </li>
- <li role="presentation"><a href="<%= context_url(@context, :context_url) %>/modules/items/<%= module_item ? module_item.id : "{{ id }}" %>" class="delete_item_link delete_link" title="{{#t}}Remove this item from the module') %>"><i class="icon-trash"></i> <%= t('Remove{{/t}}</a></li>
- <% menu_type_to_class.each do |menu_type, content_class| %>
- <% if !module_item || module_item.content.is_a?(content_class) %>
- <%
- launch_options = {}
- if menu_type == :file_menu
- launch_options[:files] = [module_item ? module_item.content_id : "{{ content_id }}"]
- else
- launch_options[:module_items] = [module_item ? module_item.id : "{{ id }}"]
- end
- %>
- <%= external_tools_menu_items(@menu_tools[menu_type], {link_class: "menu_tool_link", settings_key: menu_type, in_list: true, url_params: launch_options}) %>
- <% end %>
- <% end %>
- </ul>
- </div>
- </div>
- <% end %>
- </div>
- </li>
|