Restrict dnd sorting of Assignments to the drag handle
Before, you could drag from anywhere in the assignment or assignment group. This (1) is different from other pages (e.g. Modules), and causes issues on screen < 768 wide, where the layout changes and the assignment is full-width and you can't scroll on a mobile device. closes LA-711 flag=none test plan: - load up a course assignments page, with a couple assignments > expect you can drag to sort them only by the drag handle > expect the same on the assignment group heading too Change-Id: Ie43bf28f6b34422120ed65d04a95cb35715deb12 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/230575 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Jeremy Stanley <jeremy@instructure.com> Product-Review: Lauren Williams <lcwilliams@instructure.com>
This commit is contained in:
parent
035a377fcb
commit
82ea3e95d7
|
@ -53,8 +53,8 @@ export default class DraggableCollectionView extends CollectionView
|
|||
super
|
||||
@collection.on 'add', @_noItemsViewIfEmpty
|
||||
|
||||
initSort: ->
|
||||
@$list.sortable(_.extend({}, @sortOptions, scope: @cid))
|
||||
initSort: (opts = {}) ->
|
||||
@$list.sortable(_.extend({}, @sortOptions, opts, scope: @cid))
|
||||
.on('sortstart', @modifyPlaceholder)
|
||||
.on('sortreceive', @_onReceive)
|
||||
.on('sortupdate', @_updateSort)
|
||||
|
|
|
@ -40,8 +40,8 @@ export default class SortableCollectionView extends CollectionView
|
|||
# Internal: Enable sorting of the this view's itemViews.
|
||||
#
|
||||
# Returns nothing.
|
||||
_initSort: ->
|
||||
@$list.sortable(_.extend({}, @sortOptions, scope: @cid))
|
||||
_initSort: (opts = {}) ->
|
||||
@$list.sortable(_.extend({}, @sortOptions, opts, scope: @cid))
|
||||
@$list.on('sortupdate', @_updateSort)
|
||||
@$list.disableSelection()
|
||||
|
||||
|
|
|
@ -153,7 +153,8 @@ export default class AssignmentGroupListItemView extends DraggableCollectionView
|
|||
@cache.set(key, true)
|
||||
|
||||
initSort: ->
|
||||
super
|
||||
opts = if ENV?.FEATURES?.responsive_2020_03 then {handle: '.draggable-handle'} else {}
|
||||
super(opts)
|
||||
@$list.on('sortactivate', @startSort)
|
||||
.on('sortdeactivate', @endSort)
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ export default class AssignmentGroupListView extends SortableCollectionView
|
|||
)
|
||||
|
||||
_initSort: ->
|
||||
super
|
||||
opts = if ENV?.FEATURES?.responsive_2020_03 then {handle: '.sortable-handle'} else {}
|
||||
super(opts)
|
||||
@$list.on('sortstart', @collapse)
|
||||
@$list.on('sortstop', @expand)
|
||||
|
||||
|
|
|
@ -176,7 +176,8 @@ class ApplicationController < ActionController::Base
|
|||
la_620_old_rce_init_fix: Account.site_admin.feature_enabled?(:la_620_old_rce_init_fix),
|
||||
cc_in_rce_video_tray: Account.site_admin.feature_enabled?(:cc_in_rce_video_tray),
|
||||
featured_help_links: Account.site_admin.feature_enabled?(:featured_help_links),
|
||||
show_qr_login: Object.const_defined?("InstructureMiscPlugin") && !!@domain_root_account&.feature_enabled?(:mobile_qr_login)
|
||||
show_qr_login: Object.const_defined?("InstructureMiscPlugin") && !!@domain_root_account&.feature_enabled?(:mobile_qr_login),
|
||||
responsive_2020_03: !!@domain_root_account&.feature_enabled?(:responsive_2020_03)
|
||||
}
|
||||
}
|
||||
@js_env[:current_user] = @current_user ? Rails.cache.fetch(['user_display_json', @current_user].cache_key, :expires_in => 1.hour) { user_display_json(@current_user, :profile, [:avatar_is_fallback]) } : {}
|
||||
|
|
|
@ -27,7 +27,7 @@ describe "analytics in Canvas" do
|
|||
include Factories
|
||||
|
||||
context "Analytics 2.0 LTI installed" do
|
||||
before :once do
|
||||
before :once do
|
||||
@admin = account_admin_user(:active_all => true)
|
||||
# Analytics1.0 is enabled for all tests by default
|
||||
@admin.account.update(allowed_services: "+analytics")
|
||||
|
@ -36,25 +36,25 @@ describe "analytics in Canvas" do
|
|||
@tool_id = @admin.account.context_external_tools.first.id
|
||||
# create a course, @teacher and student in course
|
||||
@course = course_with_teacher(
|
||||
:account => @admin.account,
|
||||
:course_name => "A New Course",
|
||||
name: 'Teacher1',
|
||||
:account => @admin.account,
|
||||
:course_name => "A New Course",
|
||||
name: 'Teacher1',
|
||||
:active_all => true
|
||||
).course
|
||||
@student = student_in_course(
|
||||
:course => @course,
|
||||
:name => "First Student",
|
||||
:course => @course,
|
||||
:name => "First Student",
|
||||
:active_all => true
|
||||
).user
|
||||
@admin.account.enable_feature!(:student_context_cards)
|
||||
end
|
||||
|
||||
describe "student context tray for teacher role" do
|
||||
context "with A2 FF enabled" do
|
||||
context "with A2 FF enabled" do
|
||||
before :each do
|
||||
@course.root_account.enable_feature!(:analytics_2)
|
||||
user_session(@teacher)
|
||||
|
||||
|
||||
visit_course_people_page(@course.id)
|
||||
course_user_link(@student.id).click
|
||||
wait_for_student_tray
|
||||
|
@ -65,11 +65,11 @@ describe "analytics in Canvas" do
|
|||
end
|
||||
end
|
||||
|
||||
context "with A2 FF disabled" do
|
||||
context "with A2 FF disabled" do
|
||||
before :each do
|
||||
@course.root_account.disable_feature!(:analytics_2)
|
||||
user_session(@teacher)
|
||||
|
||||
|
||||
visit_course_people_page(@course.id)
|
||||
course_user_link(@student.id).click
|
||||
wait_for_student_tray
|
||||
|
@ -81,19 +81,20 @@ describe "analytics in Canvas" do
|
|||
end
|
||||
end
|
||||
|
||||
context "with permissions" do
|
||||
context "with permissions" do
|
||||
context "with A2 FF disabled and view_analytics permission disabled" do
|
||||
before :each do
|
||||
@course.account.role_overrides.create!(:permission => :view_analytics, :role => teacher_role, :enabled => false)
|
||||
@course.root_account.disable_feature!(:analytics_2)
|
||||
user_session(@teacher)
|
||||
|
||||
|
||||
visit_course_people_page(@course.id)
|
||||
course_user_link(@student.id).click
|
||||
wait_for_student_tray
|
||||
end
|
||||
|
||||
it "does not display Analytics 1 button" do
|
||||
skip "Flakey spec. Fix via LA-849"
|
||||
expect(student_tray_quick_links.text).not_to include('Analytics')
|
||||
end
|
||||
end
|
||||
|
@ -103,7 +104,7 @@ describe "analytics in Canvas" do
|
|||
@course.account.role_overrides.create!(:permission => :view_all_grades, :role => teacher_role, :enabled => false)
|
||||
@course.root_account.enable_feature!(:analytics_2)
|
||||
user_session(@teacher)
|
||||
|
||||
|
||||
visit_course_people_page(@course.id)
|
||||
course_user_link(@student.id).click
|
||||
wait_for_student_tray
|
||||
|
|
|
@ -773,6 +773,29 @@ describe "assignments" do
|
|||
expect(as.collect(&:position)).to eq [2, 1, 3, 4]
|
||||
end
|
||||
|
||||
context "with Responsive fix" do
|
||||
before :each do
|
||||
Account.default.enable_feature!('responsive_2020_03')
|
||||
end
|
||||
|
||||
it "should reorder assignments with drag and drop", priority: "2", test_id: 647848 do
|
||||
ag = @course.assignment_groups.first
|
||||
as = []
|
||||
4.times do |i|
|
||||
as << @course.assignments.create!(:name => "assignment_#{i}", :assignment_group => ag)
|
||||
end
|
||||
expect(as.collect(&:position)).to eq [1, 2, 3, 4]
|
||||
|
||||
get "/courses/#{@course.id}/assignments"
|
||||
wait_for_ajaximations
|
||||
drag_with_js("#assignment_#{as[0].id} .draggable-handle", 0, 50)
|
||||
wait_for_ajaximations
|
||||
|
||||
as.each { |a| a.reload }
|
||||
expect(as.collect(&:position)).to eq [2, 1, 3, 4]
|
||||
end
|
||||
end
|
||||
|
||||
context "with modules" do
|
||||
before do
|
||||
@module = @course.context_modules.create!(:name => "module 1")
|
||||
|
|
Loading…
Reference in New Issue