mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-36002 Drag and Drop: Improvements to keyboard drag and drop
List of fixes: * Add a simulated drag start event to fix problems with block drag and drop that were expecting it. * Add an access-hidden title for the General section in a course format. This is used to provide the text for the drop region (better than the first activity in the section) * Changed the text in the list to 'Move to "General"' instead of 'Move after General'. This makes more sense for activities when you have a list of activities and sections together.
This commit is contained in:
parent
dd66b6ab48
commit
bbb483b259
@ -172,9 +172,11 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
// When on a section page, we only display the general section title, if title is not the default one
|
||||
$hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name)));
|
||||
|
||||
$classes = ' accesshide';
|
||||
if ($hasnamenotsecpg || $hasnamesecpg) {
|
||||
$o.= $this->output->heading($this->section_title($section, $course), 3, 'sectionname');
|
||||
$classes = '';
|
||||
}
|
||||
$o.= $this->output->heading($this->section_title($section, $course), 3, 'sectionname' . $classes);
|
||||
|
||||
$o.= html_writer::start_tag('div', array('class' => 'summary'));
|
||||
$o.= $this->format_summary_text($section);
|
||||
|
@ -2978,7 +2978,7 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
|
||||
'move',
|
||||
'movesection',
|
||||
'movecontent',
|
||||
'aftercontent',
|
||||
'tocontent',
|
||||
'emptydragdropregion'
|
||||
), 'moodle');
|
||||
|
||||
|
@ -115,7 +115,6 @@ $string['administratorsandteachers'] = 'Administrators and teachers';
|
||||
$string['advanced'] = 'Advanced';
|
||||
$string['advancedfilter'] = 'Advanced search';
|
||||
$string['advancedsettings'] = 'Advanced settings';
|
||||
$string['aftercontent'] = 'After {$a}';
|
||||
$string['again'] = 'again';
|
||||
$string['aimid'] = 'AIM ID';
|
||||
$string['ajaxuse'] = 'AJAX and Javascript';
|
||||
@ -1676,6 +1675,7 @@ $string['time'] = 'Time';
|
||||
$string['timezone'] = 'Timezone';
|
||||
$string['to'] = 'To';
|
||||
$string['tocreatenewaccount'] = 'Skip to create new account';
|
||||
$string['tocontent'] = 'To item "{$a}"';
|
||||
$string['today'] = 'Today';
|
||||
$string['todaylogs'] = 'Today\'s logs';
|
||||
$string['toeveryone'] = 'to everyone';
|
||||
|
@ -302,7 +302,7 @@ class page_requirements_manager {
|
||||
}
|
||||
// Strings for drag and drop.
|
||||
$this->strings_for_js(array('movecontent',
|
||||
'aftercontent',
|
||||
'tocontent',
|
||||
'emptydragdropregion'),
|
||||
'moodle');
|
||||
$page->requires->yui_module('moodle-core-blocks', 'M.core_blocks.init_dragdrop', array($params), null, true);
|
||||
|
9
lib/yui/dragdrop/dragdrop.js
vendored
9
lib/yui/dragdrop/dragdrop.js
vendored
@ -283,7 +283,7 @@ YUI.add('moodle-core-dragdrop', function(Y) {
|
||||
listlink = Y.Node.create('<a></a>');
|
||||
nodetitle = this.find_element_text(labelroot);
|
||||
|
||||
listitemtext = M.util.get_string('aftercontent', 'moodle', nodetitle);
|
||||
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
|
||||
listlink.setContent(listitemtext);
|
||||
|
||||
// Add a data attribute so we can get the real drop target.
|
||||
@ -339,7 +339,6 @@ YUI.add('moodle-core-dragdrop', function(Y) {
|
||||
* @param {Node} dropnode The node to initiate the drop on
|
||||
*/
|
||||
simulated_drag_drop_event : function(dragnode, dropnode) {
|
||||
this.target = dropnode;
|
||||
|
||||
// Subclass for wrapping both drag and drop.
|
||||
var dragdropwrapper = function(node) {
|
||||
@ -367,6 +366,7 @@ YUI.add('moodle-core-dragdrop', function(Y) {
|
||||
// Create instances of the dragdropwrapper.
|
||||
this.drop = new dragdropwrapper(dropnode);
|
||||
this.drag = new dragdropwrapper(dragnode);
|
||||
this.target = this.drop;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -386,8 +386,11 @@ YUI.add('moodle-core-dragdrop', function(Y) {
|
||||
M.core.dragdrop.dropui.hide();
|
||||
// Cancel the event.
|
||||
e.preventDefault();
|
||||
// Convert to a drag drop event.
|
||||
// Convert to drag drop events.
|
||||
var dragevent = new this.simulated_drag_drop_event(dragcontainer, dragcontainer);
|
||||
var dropevent = new this.simulated_drag_drop_event(dragcontainer, droptarget);
|
||||
// Simulate the full sequence.
|
||||
this.drag_start(dragevent);
|
||||
this.global_drop_over(dropevent);
|
||||
this.global_drop_hit(dropevent);
|
||||
M.core.dragdrop.keydraghandle.focus();
|
||||
|
Loading…
x
Reference in New Issue
Block a user