diff --git a/app/coffeescripts/views/wiki/WikiPageIndexView.js b/app/coffeescripts/views/wiki/WikiPageIndexView.js index 27c67157c71..521d976f58c 100644 --- a/app/coffeescripts/views/wiki/WikiPageIndexView.js +++ b/app/coffeescripts/views/wiki/WikiPageIndexView.js @@ -26,7 +26,7 @@ import itemView from './WikiPageIndexItemView' import template from 'jst/wiki/WikiPageIndex' import StickyHeaderMixin from '../StickyHeaderMixin' import splitAssetString from '../../str/splitAssetString' -import ContentTypeExternalToolTray from './ContentTypeExternalToolTray' +import ContentTypeExternalToolTray from 'jsx/shared/ContentTypeExternalToolTray' import DirectShareCourseTray from 'jsx/shared/direct_share/DirectShareCourseTray' import DirectShareUserModal from 'jsx/shared/direct_share/DirectShareUserModal' import 'jquery.disableWhileLoading' diff --git a/app/controllers/context_modules_controller.rb b/app/controllers/context_modules_controller.rb index 7d67507c4b6..93df2391e84 100644 --- a/app/controllers/context_modules_controller.rb +++ b/app/controllers/context_modules_controller.rb @@ -75,6 +75,8 @@ class ContextModulesController < ApplicationController :root_account => @domain_root_account, :current_user => @current_user).to_a placements.select { |p| @menu_tools[p] = tools.select{|t| t.has_placement? p} } + @module_index_tools = @domain_root_account&.feature_enabled?(:commons_favorites) ? external_tools_display_hashes(:module_index_menu) : [] + module_file_details = load_module_file_details if @context.grants_right?(@current_user, session, :manage_content) js_env :course_id => @context.id, :CONTEXT_URL_ROOT => polymorphic_path([@context]), @@ -84,7 +86,8 @@ class ContextModulesController < ApplicationController :MODULE_FILE_PERMISSIONS => { usage_rights_required: @context.usage_rights_required?, manage_files: @context.grants_right?(@current_user, session, :manage_files) - } + }, + :MODULE_INDEX_TOOLS => @module_index_tools is_master_course = MasterCourses::MasterTemplate.is_master_course?(@context) is_child_course = MasterCourses::ChildSubscription.is_child_course?(@context) diff --git a/app/helpers/context_external_tools_helper.rb b/app/helpers/context_external_tools_helper.rb index 5c1c463374c..418117ce1db 100644 --- a/app/helpers/context_external_tools_helper.rb +++ b/app/helpers/context_external_tools_helper.rb @@ -44,7 +44,8 @@ module ContextExternalToolsHelper end link_attrs = { - href: tool[:base_url] + :href => tool[:base_url], + "data-tool-id" => tool[:id] } link_attrs[:class] = options[:link_class] if options[:link_class] diff --git a/app/jsx/external_apps/components/ExternalToolPlacementButton.js b/app/jsx/external_apps/components/ExternalToolPlacementButton.js index 0731427bf4f..a1587094544 100644 --- a/app/jsx/external_apps/components/ExternalToolPlacementButton.js +++ b/app/jsx/external_apps/components/ExternalToolPlacementButton.js @@ -93,6 +93,7 @@ export default class ExternalToolPlacementButton extends React.Component { link_selection: I18n.t('Link Selection'), migration_selection: I18n.t('Migration Selection'), module_menu: I18n.t('Module Menu'), + module_index_menu: I18n.t('Modules Index Menu'), post_grades: I18n.t('Sync Grades'), quiz_menu: I18n.t('Quiz Menu'), student_context_card: I18n.t('Student Context Card'), diff --git a/app/coffeescripts/views/wiki/ContentTypeExternalToolTray.js b/app/jsx/shared/ContentTypeExternalToolTray.js similarity index 95% rename from app/coffeescripts/views/wiki/ContentTypeExternalToolTray.js rename to app/jsx/shared/ContentTypeExternalToolTray.js index 392c5d4844a..87072d51112 100644 --- a/app/coffeescripts/views/wiki/ContentTypeExternalToolTray.js +++ b/app/jsx/shared/ContentTypeExternalToolTray.js @@ -34,6 +34,11 @@ const toolShape = shape({ icon_url: string }) +const moduleShape = shape({ + id: string.isRequired, + name: string.isRequired +}) + const knownResourceTypes = [ 'assignment', 'assignment_group', @@ -53,7 +58,7 @@ ContentTypeExternalToolTray.propTypes = { acceptedResourceTypes: arrayOf(oneOf(knownResourceTypes)).isRequired, targetResourceType: oneOf(knownResourceTypes).isRequired, allowItemSelection: bool.isRequired, - selectableItems: arrayOf(oneOf(knownResourceTypes)).isRequired, + selectableItems: arrayOf(moduleShape).isRequired, onDismiss: func, open: bool } diff --git a/app/coffeescripts/views/wiki/__tests__/ContentTypeExternalToolTray.test.js b/app/jsx/shared/__tests__/ContentTypeExternalToolTray.test.js similarity index 96% rename from app/coffeescripts/views/wiki/__tests__/ContentTypeExternalToolTray.test.js rename to app/jsx/shared/__tests__/ContentTypeExternalToolTray.test.js index 98124b92d2f..00908536033 100644 --- a/app/coffeescripts/views/wiki/__tests__/ContentTypeExternalToolTray.test.js +++ b/app/jsx/shared/__tests__/ContentTypeExternalToolTray.test.js @@ -18,7 +18,7 @@ import React from 'react' import {render, fireEvent} from '@testing-library/react' -import ContentTypeExternalToolTray from 'compiled/views/wiki/ContentTypeExternalToolTray' +import ContentTypeExternalToolTray from '../ContentTypeExternalToolTray' describe('ContentTypeExternalToolTray', () => { const tool = {id: 1, base_url: 'https://one.lti.com/', title: 'First LTI'} diff --git a/app/models/lti/resource_placement.rb b/app/models/lti/resource_placement.rb index ace2d4ecc37..0d7f67b4ff8 100644 --- a/app/models/lti/resource_placement.rb +++ b/app/models/lti/resource_placement.rb @@ -52,6 +52,7 @@ module Lti :link_selection, :migration_selection, :module_menu, + :module_index_menu, :post_grades, :quiz_menu, :resource_selection, diff --git a/app/views/context_modules/_content_next.html.erb b/app/views/context_modules/_content_next.html.erb index 134c8e2e2d3..02eb64d4716 100644 --- a/app/views/context_modules/_content_next.html.erb +++ b/app/views/context_modules/_content_next.html.erb @@ -61,6 +61,18 @@ <%= t('#context_modules.buttons.add_module', 'Module') %> <% end %> + <% if @module_index_tools.present? %> +
+ <% end %> <% if @last_web_export %> @@ -73,6 +85,7 @@ +