Commit 77e6ca38 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow files to be dropped on folder names in the navigation (bug #889975)



This allows files and folders to be moved up more than one level in a
single action.

Change-Id: Ib0d20cf5030a127dc113e35d7690be911ddbe0ae
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent e712a3e1
......@@ -374,6 +374,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
self.make_icon_draggable(elem);
});
forEach(getElementsByTagAndClassName('tr', 'folder', self.id + '_filelist'), self.make_row_droppable);
forEach(getElementsByTagAndClassName('a', 'changefolder', self.id + '_foldernav'), self.make_folderlink_droppable);
}
}
forEach(getElementsByTagAndClassName('a', 'changeowner', self.id + '_upload_browse'), function (elem) {
......@@ -445,6 +446,25 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
undoPositioned(row);
};
this.make_folderlink_droppable = function(link) {
new Droppable(link, {
accept: ['icon-drag-current'],
hoverclass: 'folderhover',
ondrop: function (dragged, dropped) {
var dragid = dragged.id.replace(/^.*drag:(\d+)$/, '$1');
var dropid = dropped.href.replace(/^.*\?folder=(\d+)$/, '$1');
if (dragid == dropid) {
return;
}
$(self.id + '_move').value = dragid;
$(self.id + '_moveto').value = dropid;
self.submitform();
$(self.id + '_move').value = '';
$(self.id + '_moveto').value = '';
}
});
};
this.drag = {};
this.make_icon_draggable = function(elem) {
......
......@@ -161,7 +161,7 @@ tr.folder td.filename {
tr.folderhover td {
background-color: #ffc;
}
tr.folderhover a {
tr.folderhover a, .foldernav a.folderhover {
text-decoration: none;
}
.icon-drag {
......
Supports Markdown
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