Commit caa28af8 authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review

Merge "Bug 1441945: showing the 'cancel' option when we don't need to"

parents 3d98863f c859f497
......@@ -471,8 +471,8 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
self.move_list.remove();
}
var movefoldercount = $j('#' + self.id + '_filelist a.changefolder').length;
var ul = $j('<ul>').addClass('file-move-list');
$j('#' + self.id + '_filelist a.changefolder').each(function(i) {
var title = $j(this);
var elemid = title.attr('href').replace(/.+folder=/, '');
......@@ -493,7 +493,14 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
});
ul.append($j('<li>').append(link));
}
else {
movefoldercount --;
}
});
// When we have no folders, or one folder and we click the folder icon.
if (movefoldercount == 0) {
return '';
}
var cancellink = $j('<a>').attr('href', '#').html(get_string('cancel'));
cancellink.on('click keydown', function(e) {
......@@ -518,8 +525,10 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
$j(icon).on('mousedown keydown', function(e) {
if (e.type == 'mousedown' || e.keyCode == 32 || e.keyCode == 13) {
var folderlist = self.create_move_list(icon, id);
$j(icon).closest('tr').find('.filename').append(folderlist);
folderlist.find('a').first().focus();
if (folderlist != '') {
$j(icon).closest('tr').find('.filename').append(folderlist);
folderlist.find('a').first().focus();
}
}
});
};
......
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