Add a button to empty the trash in the drive
This commit is contained in:
@@ -164,10 +164,11 @@ define([
|
|||||||
var $unsortedIcon = $('<span>', {"class": "fa fa-files-o"});
|
var $unsortedIcon = $('<span>', {"class": "fa fa-files-o"});
|
||||||
var $templateIcon = $('<span>', {"class": "fa fa-cubes"});
|
var $templateIcon = $('<span>', {"class": "fa fa-cubes"});
|
||||||
var $recentIcon = $('<span>', {"class": "fa fa-clock-o"});
|
var $recentIcon = $('<span>', {"class": "fa fa-clock-o"});
|
||||||
var $trashIcon = $('<span>', {"class": "fa fa-trash-o"});
|
var $trashIcon = $('<span>', {"class": "fa fa-trash"});
|
||||||
var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"});
|
var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"});
|
||||||
//var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o expcol"});
|
//var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o expcol"});
|
||||||
var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o expcol"});
|
var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o expcol"});
|
||||||
|
var $emptyTrashIcon = $('<button>', {"class": "fa fa-ban"});
|
||||||
var $listIcon = $('<button>', {"class": "fa fa-list"});
|
var $listIcon = $('<button>', {"class": "fa fa-list"});
|
||||||
var $gridIcon = $('<button>', {"class": "fa fa-th-large"});
|
var $gridIcon = $('<button>', {"class": "fa fa-th-large"});
|
||||||
var $sortAscIcon = $('<span>', {"class": "fa fa-angle-up sortasc"});
|
var $sortAscIcon = $('<span>', {"class": "fa fa-angle-up sortasc"});
|
||||||
@@ -696,6 +697,11 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var updateContextButton = function () {
|
var updateContextButton = function () {
|
||||||
|
if (filesOp.isPathIn(currentPath, [TRASH])) {
|
||||||
|
$driveToolbar.find('cp-app-drive-toolbar-emptytrash').show();
|
||||||
|
} else {
|
||||||
|
$driveToolbar.find('cp-app-drive-toolbar-emptytrash').hide();
|
||||||
|
}
|
||||||
var $li = $content.find('.selected');
|
var $li = $content.find('.selected');
|
||||||
if ($li.length === 0) {
|
if ($li.length === 0) {
|
||||||
$li = findDataHolder($tree.find('.active'));
|
$li = findDataHolder($tree.find('.active'));
|
||||||
@@ -1389,6 +1395,18 @@ define([
|
|||||||
$gridButton.attr('title', Messages.fm_viewGridButton);
|
$gridButton.attr('title', Messages.fm_viewGridButton);
|
||||||
$container.append($listButton).append($gridButton);
|
$container.append($listButton).append($gridButton);
|
||||||
};
|
};
|
||||||
|
var createEmptyTrashButton = function ($container) {
|
||||||
|
var $button = $emptyTrashIcon.clone().addClass('element');
|
||||||
|
$button.addClass('cp-app-drive-toolbar-emptytrash');
|
||||||
|
$button.attr('title', Messages.fc_empty);
|
||||||
|
$button.click(function () {
|
||||||
|
Cryptpad.confirm(Messages.fm_emptyTrashDialog, function(res) {
|
||||||
|
if (!res) { return; }
|
||||||
|
filesOp.emptyTrash(refresh);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$container.append($button);
|
||||||
|
};
|
||||||
|
|
||||||
var getNewPadTypes = function () {
|
var getNewPadTypes = function () {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
@@ -1961,6 +1979,7 @@ define([
|
|||||||
path = [ROOT];
|
path = [ROOT];
|
||||||
}
|
}
|
||||||
var isInRoot = filesOp.isPathIn(path, [ROOT]);
|
var isInRoot = filesOp.isPathIn(path, [ROOT]);
|
||||||
|
var inTrash = filesOp.isPathIn(path, [TRASH]);
|
||||||
var isTrashRoot = filesOp.comparePath(path, [TRASH]);
|
var isTrashRoot = filesOp.comparePath(path, [TRASH]);
|
||||||
var isTemplate = filesOp.comparePath(path, [TEMPLATE]);
|
var isTemplate = filesOp.comparePath(path, [TEMPLATE]);
|
||||||
var isAllFiles = filesOp.comparePath(path, [FILES_DATA]);
|
var isAllFiles = filesOp.comparePath(path, [FILES_DATA]);
|
||||||
@@ -2007,6 +2026,10 @@ define([
|
|||||||
}
|
}
|
||||||
createViewModeButton($toolbar.find('.rightside'));
|
createViewModeButton($toolbar.find('.rightside'));
|
||||||
}
|
}
|
||||||
|
if (inTrash) {
|
||||||
|
createEmptyTrashButton($toolbar.find('.rightside'));
|
||||||
|
}
|
||||||
|
|
||||||
var $list = $('<ul>').appendTo($dirContent);
|
var $list = $('<ul>').appendTo($dirContent);
|
||||||
|
|
||||||
// NewButton can be undefined if we're in read only mode
|
// NewButton can be undefined if we're in read only mode
|
||||||
|
|||||||
Reference in New Issue
Block a user