modules direct share menu items
closes: ADMIN-2781 flag: direct_share test plan: - NOTE: the modules page is cached, so you might have to wait a minute or refresh a couple times in order for changes to show up after you change the flag. - teacher view of modules should have new menu items only when the feature flag is on - This applies to both modules and module items - Should also work when modules is the course home page Change-Id: I5db1ff3c5ffffaaef19b01e9f6e1f54fa3b6026b Reviewed-on: https://gerrit.instructure.com/203460 Tested-by: Jenkins Reviewed-by: Mysti Lilla <mysti@instructure.com> QA-Review: Anju Reddy <areddy@instructure.com> Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
This commit is contained in:
parent
bb392e94f7
commit
003f28e1f4
|
@ -103,6 +103,7 @@ class ContextModulesController < ApplicationController
|
||||||
log_asset_access([ "modules", @context ], "modules", "other")
|
log_asset_access([ "modules", @context ], "modules", "other")
|
||||||
load_modules
|
load_modules
|
||||||
|
|
||||||
|
js_env(DIRECT_SHARE_ENABLED: @domain_root_account&.feature_enabled?(:direct_share))
|
||||||
set_tutorial_js_env
|
set_tutorial_js_env
|
||||||
|
|
||||||
if @is_student
|
if @is_student
|
||||||
|
|
|
@ -168,6 +168,26 @@
|
||||||
aria-label="<%= t('Duplicate %{module_name}', {module_name: context_module ? context_module.name : 'module'} ) %>"
|
aria-label="<%= t('Duplicate %{module_name}', {module_name: context_module ? context_module.name : 'module'} ) %>"
|
||||||
title="<%= t(%{Duplicate this module}) %>"><%= t(%{Duplicate}) %></a>
|
title="<%= t(%{Duplicate this module}) %>"><%= t(%{Duplicate}) %></a>
|
||||||
</li>
|
</li>
|
||||||
|
<% if @domain_root_account&.feature_enabled?(:direct_share) %>
|
||||||
|
<li role="presentation">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="module_send_to icon-user"
|
||||||
|
aria-label="<%= t("Send this module to another user..." ) %>"
|
||||||
|
title="<%= t("Send this module to another user..." ) %>">
|
||||||
|
<%= t("Send To...") %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="module_copy_to icon-duplicate"
|
||||||
|
aria-label="<%= t("Copy this module to a course..." ) %>"
|
||||||
|
title="<%= t("Copy this module to a course..." ) %>">
|
||||||
|
<%= t("Copy To...") %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<%= external_tools_menu_items(@menu_tools[:module_menu], {link_class: "menu_tool_link", settings_key: :module_menu, in_list: true, url_params: {:modules => [context_module ? context_module.id : "{{ id }}"]}}) %>
|
<%= external_tools_menu_items(@menu_tools[:module_menu], {link_class: "menu_tool_link", settings_key: :module_menu, in_list: true, url_params: {:modules => [context_module ? context_module.id : "{{ id }}"]}}) %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
'edit' => "<i class='icon-edit'></i>".html_safe,
|
'edit' => "<i class='icon-edit'></i>".html_safe,
|
||||||
'delete' => "<i class='icon-end'></i>".html_safe,
|
'delete' => "<i class='icon-end'></i>".html_safe,
|
||||||
'duplicate' => "<i class='icon-copy-course'></i>".html_safe,
|
'duplicate' => "<i class='icon-copy-course'></i>".html_safe,
|
||||||
|
'copy_to' => "<i class='icon-duplicate'></i>".html_safe,
|
||||||
|
'send_to' => "<i class='icon-user'></i>".html_safe,
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_type_to_class = {
|
menu_type_to_class = {
|
||||||
|
@ -249,6 +251,26 @@
|
||||||
><%= t("Move to...") %></a>
|
><%= t("Move to...") %></a>
|
||||||
</li>
|
</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') %></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') %></a></li>
|
||||||
|
<% if @domain_root_account&.feature_enabled?(:direct_share) %>
|
||||||
|
<li role="presentation">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="module_item_send_to"
|
||||||
|
title="<%= t("Send this module item to another user...") %>"
|
||||||
|
aria-label="<%= t("Send this module item to another user...") %>"
|
||||||
|
><%= @module_item_image_tags['send_to'] %> <%= t('Send To...') %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="module_item_copy_to"
|
||||||
|
title="<%= t('Copy this module item to a course...') %>"
|
||||||
|
aria-label="<%= t('Copy this module item to a course...') %>"
|
||||||
|
><%= @module_item_image_tags['copy_to'] %> <%= t('Copy To...') %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<% menu_type_to_class.each do |menu_type, content_class| %>
|
<% menu_type_to_class.each do |menu_type, content_class| %>
|
||||||
<% if !module_item || module_item.content.is_a?(content_class) %>
|
<% if !module_item || module_item.content.is_a?(content_class) %>
|
||||||
<%
|
<%
|
||||||
|
|
|
@ -1483,6 +1483,26 @@ function scrollTo ($thing, time = 500) {
|
||||||
.catch(showFlashError('Error duplicating item'))
|
.catch(showFlashError('Error duplicating item'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('.module_copy_to').live('click', event => {
|
||||||
|
event.preventDefault()
|
||||||
|
console.log('copy module to course')
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.module_send_to').live('click', event => {
|
||||||
|
event.preventDefault()
|
||||||
|
console.log('send module to user')
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.module_item_copy_to').live('click', event => {
|
||||||
|
event.preventDefault()
|
||||||
|
console.log('copy module item to course')
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.module_item_send_to').live('click', event => {
|
||||||
|
event.preventDefault()
|
||||||
|
console.log('send module item to user')
|
||||||
|
})
|
||||||
|
|
||||||
$("#add_module_prerequisite_dialog .cancel_button").click(function() {
|
$("#add_module_prerequisite_dialog .cancel_button").click(function() {
|
||||||
$("#add_module_prerequisite_dialog").dialog('close');
|
$("#add_module_prerequisite_dialog").dialog('close');
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,4 +102,35 @@ describe "/context_modules/index" do
|
||||||
page = Nokogiri('<document>' + response.body + '</document>')
|
page = Nokogiri('<document>' + response.body + '</document>')
|
||||||
expect(page.css(".offline_web_export").length).to eq 1
|
expect(page.css(".offline_web_export").length).to eq 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "direct_share" do
|
||||||
|
it "does not show module sharing menu items if direct_share is disabled" do
|
||||||
|
course_with_teacher
|
||||||
|
context_module = @course.context_modules.create!
|
||||||
|
context_module.add_item :type => 'context_module_sub_header'
|
||||||
|
view_context(@course, @user)
|
||||||
|
assign(:modules, @course.context_modules.active)
|
||||||
|
render 'context_modules/index'
|
||||||
|
page = Nokogiri('<document>' + response.body + '</document>')
|
||||||
|
expect(page.css(".module_copy_to").length).to eq 0
|
||||||
|
expect(page.css(".module_send_to").length).to eq 0
|
||||||
|
expect(page.css(".module_item_copy_to").length).to eq 0
|
||||||
|
expect(page.css(".module_item_send_to").length).to eq 0
|
||||||
|
end
|
||||||
|
|
||||||
|
it "shows module sharing menu items if direct_share is enabled" do
|
||||||
|
course_with_teacher
|
||||||
|
@course.root_account.enable_feature!(:direct_share)
|
||||||
|
context_module = @course.context_modules.create!
|
||||||
|
context_module.add_item :type => 'context_module_sub_header'
|
||||||
|
view_context(@course, @teacher)
|
||||||
|
assign(:modules, @course.context_modules.active)
|
||||||
|
render 'context_modules/index'
|
||||||
|
page = Nokogiri('<document>' + response.body + '</document>')
|
||||||
|
expect(page.css(".module_copy_to").length).to eq 1
|
||||||
|
expect(page.css(".module_send_to").length).to eq 1
|
||||||
|
expect(page.css(".module_item_copy_to").length).to eq 1
|
||||||
|
expect(page.css(".module_item_send_to").length).to eq 1
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue