summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorAbijeet <abijeetpatro@gmail.com>2018-06-06 23:31:25 +0530
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-06-18 07:39:44 +0200
commit0c77b93b8674db71df7d6ca24a8de600818175f6 (patch)
tree4a6e33e6e258055cce18a5bcbe6541a21928aadd /apps/files/js
parente89f6590e2983c55b1a15f700eb3258554f36197 (diff)
downloadnextcloud-server-0c77b93b8674db71df7d6ca24a8de600818175f6.tar.gz
nextcloud-server-0c77b93b8674db71df7d6ca24a8de600818175f6.zip
Fixes issues found during running of test cases.
Signed-off-by: Abijeet <abijeetpatro@gmail.com>
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/app.js2
-rw-r--r--apps/files/js/filelist.js42
-rw-r--r--apps/files/js/filemultiselectmenu.js12
3 files changed, 30 insertions, 26 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js
index f8e59a71b94..6a21bce975b 100644
--- a/apps/files/js/app.js
+++ b/apps/files/js/app.js
@@ -90,7 +90,7 @@
filesClient: OC.Files.getClient(),
multiSelectMenu: [
{
- name: 'moveCopy',
+ name: 'copyMove',
displayName: t('files', 'Move or copy'),
iconClass: 'icon-external',
},
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index c5929fbd212..cddedecda78 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -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);
}
}
}
diff --git a/apps/files/js/filemultiselectmenu.js b/apps/files/js/filemultiselectmenu.js
index 767166b06c3..d587d1fbdb2 100644
--- a/apps/files/js/filemultiselectmenu.js
+++ b/apps/files/js/filemultiselectmenu.js
@@ -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);