Browse Source

Fixes issues found during running of test cases.

Signed-off-by: Abijeet <abijeetpatro@gmail.com>
tags/v14.0.0beta1
Abijeet 6 years ago
parent
commit
0c77b93b86
No account linked to committer's email address

+ 1
- 1
apps/files/js/app.js View File

@@ -90,7 +90,7 @@
filesClient: OC.Files.getClient(),
multiSelectMenu: [
{
name: 'moveCopy',
name: 'copyMove',
displayName: t('files', 'Move or copy'),
iconClass: 'icon-external',
},

+ 22
- 20
apps/files/js/filelist.js View File

@@ -295,7 +295,8 @@

if (options.multiSelectMenu) {
this.fileMultiSelectMenu = new OCA.Files.FileMultiSelectMenu(options.multiSelectMenu);
this.$el.find('#selectedActionsList').append(this.fileMultiSelectMenu.$el);
this.fileMultiSelectMenu.render();
this.$el.find('.selectedActions').append(this.fileMultiSelectMenu.$el);
}

if (options.sorting) {
@@ -406,7 +407,7 @@
case 'download':
this._onClickDownloadSelected(ev);
break;
case 'moveCopy':
case 'copyMove':
this._onClickCopyMoveSelected(ev);
break;
case 'restore':
@@ -769,7 +770,7 @@
/**
* Event handler for when clicking on "Download" for the selected files
*/
_onClickDownloadSelected: function() {
_onClickDownloadSelected: function(event) {
var files;
var self = this;
var dir = this.getCurrentDirectory();
@@ -799,26 +800,26 @@
var first = this.getSelectedFiles()[0];
OCA.Files.Files.handleDownload(this.getDownloadUrl(first.name, dir, true), disableLoadingState);
}
return false;
event.preventDefault();
},

/**
* Event handler for when clicking on "Move" for the selected files
*/
_onClickCopyMoveSelected: function() {
_onClickCopyMoveSelected: function(event) {
var files;
var self = this;

files = _.pluck(this.getSelectedFiles(), 'name');

// don't allow a second click on the download action
if(this.fileMultiSelectMenu.isDisabled('moveCopy')) {
if(this.fileMultiSelectMenu.isDisabled('copyMove')) {
return false;
}

self.fileMultiSelectMenu.toggleLoading('moveCopy', true);
self.fileMultiSelectMenu.toggleLoading('copyMove', true);
var disableLoadingState = function(){
self.fileMultiSelectMenu.toggleLoading('moveCopy', false);
self.fileMultiSelectMenu.toggleLoading('copyMove', false);
};

var actions = this.isSelectedMovable() ? OC.dialogs.FILEPICKER_TYPE_COPY_MOVE : OC.dialogs.FILEPICKER_TYPE_COPY;
@@ -830,20 +831,19 @@
self.move(files, targetPath, disableLoadingState);
}
}, false, "httpd/unix-directory", true, actions);
return false;
event.preventDefault();
},

/**
* Event handler for when clicking on "Delete" for the selected files
*/
_onClickDeleteSelected: function() {
_onClickDeleteSelected: function(event) {
var files = null;
if (!this.isAllSelected()) {
files = _.pluck(this.getSelectedFiles(), 'name');
}
this.do_delete(files);
event.preventDefault();
return false;
},

/**
@@ -2905,20 +2905,22 @@
selection += ' (' + hiddenInfo + ')';
}

// TODO : Change here!!
this.$el.find('#headerName a.name>span:first').text(selection);
this.$el.find('#modified a>span:first').text('');
this.$el.find('table').addClass('multiselect');


this.fileMultiSelectMenu.toggleItemVisibility('download', !this.isSelectedDownloadable());
this.fileMultiSelectMenu.toggleItemVisibility('delete', !this.isSelectedDeletable());
this.fileMultiSelectMenu.toggleItemVisibility('moveCopy', !this.isSelectedCopiable());
if (this.isSelectedCopiable()) {
if (this.isSelectedMovable()) {
this.fileMultiSelectMenu.updateItemText('moveCopy', t('files', 'Move or copy'));
if (this.fileMultiSelectMenu) {
this.fileMultiSelectMenu.toggleItemVisibility('download', this.isSelectedDownloadable());
this.fileMultiSelectMenu.toggleItemVisibility('delete', this.isSelectedDeletable());
this.fileMultiSelectMenu.toggleItemVisibility('copyMove', this.isSelectedCopiable());
if (this.isSelectedCopiable()) {
if (this.isSelectedMovable()) {
this.fileMultiSelectMenu.updateItemText('copyMove', t('files', 'Move or copy'));
} else {
this.fileMultiSelectMenu.updateItemText('copyMove', t('files', 'Copy'));
}
} else {
this.fileMultiSelectMenu.updateItemText('moveCopy', t('files', 'Copy'));
this.fileMultiSelectMenu.toggleItemVisibility('copyMove', false);
}
}
}

+ 7
- 5
apps/files/js/filemultiselectmenu.js View File

@@ -51,8 +51,6 @@
*/
show: function(context) {
this._context = context;

this.render();
this.$el.removeClass('hidden');
if (window.innerWidth < 480) {
this.$el.removeClass('menu-center').addClass('menu-right');
@@ -62,11 +60,15 @@
OC.showMenu(null, this.$el);
return false;
},
toggleItemVisibility: function (itemName, hide) {
this.$el.find('.item-' + itemName).toggleClass('hidden', hide);
toggleItemVisibility: function (itemName, show) {
if (show) {
this.$el.find('.item-' + itemName).removeClass('hidden');
} else {
this.$el.find('.item-' + itemName).addClass('hidden');
}
},
updateItemText: function (itemName, translation) {
this.$el.find('.item-' + itemName).find('label').text(translation);
this.$el.find('.item-' + itemName).find('.label').text(translation);
},
toggleLoading: function (itemName, showLoading) {
var $actionElement = this.$el.find('.item-' + itemName);

+ 5
- 15
apps/files_trashbin/js/filelist.js View File

@@ -153,7 +153,6 @@
}
this.fileSummary.update();
this.updateEmptyContent();
this.enableActions();
},

_onClickRestoreSelected: function(event) {
@@ -162,7 +161,7 @@
var allFiles = this.$el.find('.select-all').is(':checked');
var files = [];
var params = {};
this.disableActions();
this.fileMultiSelectMenu.toggleLoading('restore', true);
if (allFiles) {
this.showMask();
params = {
@@ -192,13 +191,14 @@
self.hideMask();
// simply remove all files
self.setFiles([]);
self.enableActions();
}
else {
self._removeCallback(result);
}
self.fileMultiSelectMenu.toggleLoading('restore', true);
}
);
event.preventDefault();
},

_onClickDeleteSelected: function(event) {
@@ -221,7 +221,7 @@
};
}

this.disableActions();
this.fileMultiSelectMenu.toggleLoading('delete', true);
if (allFiles) {
this.showMask();
}
@@ -242,11 +242,11 @@
self.hideMask();
// simply remove all files
self.setFiles([]);
self.enableActions();
}
else {
self._removeCallback(result);
}
self.fileMultiSelectMenu.toggleLoading('delete', false);
}
);
},
@@ -268,16 +268,6 @@
return '#';
},

enableActions: function() {
this.$el.find('.action').css('display', 'inline');
this.$el.find('input:checkbox').removeClass('u-hidden');
},

disableActions: function() {
this.$el.find('.action').css('display', 'none');
this.$el.find('input:checkbox').addClass('u-hidden');
},

updateStorageStatistics: function() {
// no op because the trashbin doesn't have
// storage info like free space / used space

Loading…
Cancel
Save