Commit d3e671b3 authored by Jono Mingard's avatar Jono Mingard
Browse files

Use standard bootstrap dialog for block position (Bug #1465107)

Modify the accessible "Position block" dialog to use a normal
bootstrap modal (instead of a docked modal) - this removes the
infinite loading spinner and fixes focus management issues.

behatnotneeded

Change-Id: Idebd9304ad33a7ffc9d409cb728ad24d1facc514
parent bb921fd8
......@@ -280,9 +280,8 @@
$('.blocktype-drag').off('click keydown'); // remove old event handlers
$('.blocktype-drag').on('click keydown', function(e) {
// Add a block when click left button or press 'Space bar' or 'Enter' key
if (isHit(e) && $('#addblock').hasClass('closed')) {
if (isHit(e) && !$('#addblock').hasClass('in')) {
startAddBlock($(this));
}
});
......@@ -308,18 +307,16 @@
function startAddBlock(element) {
var addblockdialog = $('#addblock');
showDock(addblockdialog, false);
addblockdialog.modal('show');
addblockdialog.one('dialog.end', function(event, options) {
if (options.saved) {
addNewBlock(options, element.find('.blocktype-radio').val());
}
else {
element.focus();
}
});
if (options.saved) {
addNewBlock(options, element.find('.blocktype-radio').val());
}
else {
element.focus();
}
});
addblockdialog.find('h4.modal-title').text(get_string('addblock', element.text()));
computeColumnInputs(addblockdialog);
......@@ -331,8 +328,6 @@
keytabbinginadialog(addblockdialog, addblockdialog.find('.deletebutton'), addblockdialog.find('.cancel'));
}
function makeExistingBlocksSortable() {
// Make existing and new blocks sortable
......@@ -887,7 +882,7 @@
}
});
$('#addblock .submit').on('mousedown keydown', function(e) {
$('#addblock .submit').on('click keydown', function(e) {
if (isHit(e)) {
var position = $('#addblock .cell-chooser input:checked').val().split('-'),
order = $('#addblock_position').prop('selectedIndex') + 1;
......@@ -924,8 +919,7 @@
var addblockdialog = $('#addblock');
options.trigger = e.type;
addblockdialog.addClass('hidden').addClass('closed').trigger('dialog.end', options);
addblockdialog.modal('hide').trigger('dialog.end', options);
}
/*
......
......@@ -95,7 +95,7 @@
</div>
<div class="modal modal-shown modal-docked-right modal-docked closed blockinstance configure" id="addblock" role="dialog">
<div class="modal" id="addblock" role="dialog">
<div class="modal-dialog">
<div class="modal-content" data-height=".modal-body">
<div class="modal-header">
......@@ -104,7 +104,6 @@
<span class="sr-only">{str tag=Close}</span>
</button>
<h4 class="modal-title blockinstance-header text-inline" id="addblock-heading"></h4>
<span class="icon icon-cogs icon-2x pull-right"></span>
</div>
<div class="modal-body blockinstance-content pt0 pb0">
<div class="block-inner">{$addform|safe}</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment