Commit c859f497 authored by Robert Lyon's avatar Robert Lyon
Browse files

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



In the Content -> Files section if we have no folders then we don't
need to show the accessibility links when we click the file icon.

Same for when we have only one folder and we click the folder icon

Change-Id: Ibd7257bdb766d2d9da32c86d03a9e33120243d0b
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 1419d115
......@@ -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