Commit b148650d authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Improve file browser "move" accessibility (Bug #1492102)"

parents 2b08ecce 0dde0f03
......@@ -473,11 +473,11 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
self.move_list.remove();
}
var movefoldercount = $j('#' + self.id + '_filelist a.changefolder').length;
var wrapper = $j('<div>');
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=/, '');
var elemid = title.attr('id').replace(/^changefolder:/, '');
if (elemid != moveid) {
var displaytitle = title.find('.display-title').html();
var link = $j('<a>').attr('href', '#').html(get_string('moveto', displaytitle));
......@@ -493,15 +493,12 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return false;
}
});
ul.append($j('<li><span class="icon icon-folder prm"></span>').append(link));
}
else {
movefoldercount --;
ul.append($j('<li><span class="icon icon-long-arrow-right prm"></span>').append(link));
}
});
// When we have no folders, or one folder and we click the folder icon.
if (movefoldercount == 0) {
return '';
if (ul.children().length === 0) {
wrapper.append($j('<span>').html(get_string_ajax('nofolderformove', 'artefact.file')));
}
var cancellink = $j('<a>').attr('href', '#').html(get_string('cancel'));
......@@ -510,15 +507,17 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return false;
}
else if (e.type == 'click' || e.keyCode == 32 || e.keyCode == 13) {
ul.remove();
wrapper.remove();
icon.focus();
self.move_list = null;
return false;
}
});
ul.append($j('<li><span class="icon icon-remove-circle prm"></span>').append(cancellink));
ul.append($j('<li><span class="icon icon-times prm"></span>').append(cancellink));
wrapper.append(ul);
self.move_list = ul;
return ul;
self.move_list = wrapper;
return wrapper;
}
this.make_icon_keyboard_accessible = function(icon) {
......
......@@ -134,6 +134,7 @@ $string['myfiles'] = 'My files';
$string['Name'] = 'Name';
$string['namefieldisrequired'] = 'The name field is required';
$string['maxuploadsize'] = 'Maximum upload size';
$string['nofolderformove'] = 'No folder available to move to';
$string['movefaileddestinationinartefact'] = 'You cannot put a folder inside itself.';
$string['movefaileddestinationnotfolder'] = 'You can only move files into folders.';
$string['movefailednotfileartefact'] = 'Only file, folder and image artefacts can be moved.';
......
......@@ -29,44 +29,42 @@
{/if}
<tr id="file:{$file->id}" class="file-item {if $file->isparent} parentfolder{/if}{if $highlight && $highlight == $file->id} warning{/if}{if $file->artefacttype == 'folder'} folder{else}{if !$publishable } disabled {/if}{if $file->artefacttype == 'profileicon'} profileicon{/if}{/if}{if $edit == $file->id} hidden{/if}{if $selectable && ($file->artefacttype != 'folder' || $selectfolders) && $publishable && !$file->isparent} js-file-select {else} no-hover{/if}" {if $selectable && ($file->artefacttype != 'folder' || $selectfolders) && $publishable && !$file->isparent} data-id="{$file->id}" data-select="select-file" {/if} {if !$publishable && $file->artefacttype != 'folder'} title="{str tag=notpublishable section=artefact.file}"{/if}>
{assign var=displaytitle value=$file->title|safe}
<td class="icon-cell">
{if $file->isparent}
{if $file->artefacttype == 'folder'}
<a href="{$querybase|safe}folder={$file->id}{if $owner}&owner={$owner}{if $ownerid}&ownerid={$ownerid}{/if}{/if}" id="changefolder:{$file->id}" class="changefolder">
<span class="pls icon-level-up icon icon-lg text-default">
</span>
<span class="sr-only">
{str tag=folder section=artefact.file}:{$displaytitle}
</span>
</a>
{/if}
{else}
{if $editable}
<div class="icon-drag" id="drag:{$file->id}" tabindex="0">
{else}
<span class="sr-only">{str tag=clickanddragtomovefile section=artefact.file arg1=$file->title}</span>
{/if}
{if $file->artefacttype == 'folder'}
{if $selectable}
<a href="{$querybase|safe}folder={$file->id}{if $owner}&owner={$owner}{if $ownerid}&ownerid={$ownerid}{/if}{/if}" id="changefolder:{$file->id}" class="changefolder" title="{str tag=folder section=artefact.file} {$displaytitle}">
<span class="icon icon-plus expand-indicator"></span><span class="icon-folder-open icon icon-lg"></span>
</a>
{else}
<span class="pls icon-folder-open icon icon-lg "></span>
{/if}
{if $file->artefacttype == 'folder'}
{if $selectable}
<a href="{$querybase|safe}folder={$file->id}{if $owner}&owner={$owner}{if $ownerid}&ownerid={$ownerid}{/if}{/if}" id="changefolder:{$file->id}" class="changefolder" title="{str tag=folder section=artefact.file} {$displaytitle}">
<span class="icon icon-plus expand-indicator"></span><span class="icon-folder-open icon icon-lg"></span>
</a>
{else}
{if $file->icon}
<img src="{$file->icon}" title="{str tag=clickanddragtomovefile section=artefact.file arg1=$file->title}" alt="{$file->title}">
{else}
<span class="icon icon-{$file->artefacttype} icon-lg prm"></span>
{/if}
<span class="pls icon-folder-open icon icon-lg "></span>
{/if}
{else}
{if $file->icon}
<img role="presentation" src="{$file->icon}" title="{str tag=clickanddragtomovefile section=artefact.file arg1=$file->title}" alt="{$file->title}">
{else}
<span class="icon icon-{$file->artefacttype} icon-lg prm"></span>
{/if}
{/if}
{/if}
</td>
<td class="filename">
{assign var=displaytitle value=$file->title|safe}
{if $file->artefacttype == 'folder'}
<a href="{$querybase|safe}folder={$file->id}{if $owner}&owner={$owner}{if $ownerid}&ownerid={$ownerid}{/if}{/if}" id="changefolder:{$file->id}" class="inner-link changefolder">
<span class="sr-only">{str tag=folder section=artefact.file}:</span>
......
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