Skip to content
127 changes: 119 additions & 8 deletions apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ table th .columntitle.name {

table.multiselect th .columntitle.name {
margin-left: 0;
padding-left: 15px;
}

table th .sort-indicator {
Expand Down Expand Up @@ -311,9 +312,9 @@ table th.column-last, table td.column-last {
top: 94px;
}

#app-content-recent,
#app-content-favorites,
#app-content-shareoverview,
#app-content-recent,
#app-content-favorites,
#app-content-shareoverview,
#app-content-sharingout,
#app-content-sharingin,
#app-content-sharinglinks,
Expand All @@ -333,7 +334,7 @@ table.multiselect thead th {

table.multiselect #headerName {
position: relative;
width: 9999px; /* when we use 100%, the styling breaks on mobile … table styling */
width: auto;
}
table.multiselect #modified {
display: none;
Expand Down Expand Up @@ -721,7 +722,7 @@ a.action > img {
.summary {
color: var(--color-text-maxcontrast);
/* add whitespace to bottom of files list to correctly show dropdowns */
$action-menu-items-count: 7; // list view has currently max 7 items in its action menu
$action-menu-items-count: 7; // list view has currently max 7 items in its action menu
height: 44px * ($action-menu-items-count + 0.5); // 0.5 is added to show some whitespace below
}
#filestable .filesummary {
Expand Down Expand Up @@ -859,7 +860,7 @@ table.dragshadow td.size {
overflow: auto;
min-width: 160px;
height: 54px;

&:not(.hidden) {
display: flex;
}
Expand Down Expand Up @@ -911,11 +912,9 @@ table.dragshadow td.size {
/* HEADER and MULTISELECT */
thead {
tr {
display: block;
border-bottom: 1px solid var(--color-border);
background-color: var(--color-main-background-translucent);
th {
width: auto;
border: none;
}
}
Expand Down Expand Up @@ -1238,3 +1237,115 @@ table.dragshadow td.size {
}
}

/* Actions for selected files */
#headerSize .hidden {
display: none;
}

#headerDate .hidden {
display: none;
}

#headerSizeOpen .hidden {
display: none;
}

table.multiselect {
thead {
#selectedMenu {
width: 100% !important;
}
}
}

.multiselect {
.sort-indicator {
display: none !important;
}
}

#selectedActionLabel {
padding-right: 16px;
display: none;
a {
display: inline;
line-height: 50px;
padding: 16px 5px;
img {
position: relative;
vertical-align: text-bottom;
margin-bottom: -1px;
}
}
a.hidden {
display: none;
}
.actions-selected {
.icon-more {
display: inline-block;
vertical-align: middle;
}
}
}

#headerSizeCount .hidden {
display: none !important;
}

.selectedActions {
.filesSelectionMenu {
display: block !important;
ul {
li {
display: inline;
&.hidden {
display: none !important;
}
}
}
a {
.label {
padding-left: 8px;
padding-right: 19px;
}
&:hover {
.label {
text-decoration: underline;
}
}
}
.item-delete {
a {
&:hover {
color: #ff0000;
filter: invert(18%) sepia(99%) saturate(7440%) hue-rotate(1deg) brightness(110%) contrast(115%);
}
}
}
}
}

#selectedActionsList {
width: 100% !important;
text-align: right !important;
opacity: unset;
.popovermenu {
right: -70px;
top: 45px;
}
}

#allLabel {
padding-top: 5px;
}

.item-cancel {
a {
.label {
color: #ff0000;
}
}
.icon-close {
filter: invert(18%) sepia(99%) saturate(7440%) hue-rotate(1deg) brightness(110%) contrast(115%);
}
}
29 changes: 29 additions & 0 deletions apps/files/css/mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,33 @@ table.dragshadow {
table.multiselect th .columntitle.name {
margin-left: 0;
}

/* Actions for selected files */
table th #selectedActionLabel a {
padding: 17px 14px;
}

#allLabel {
display: none;
}

#selectedActionsList .filesSelectionMenu {
display: none !important;
}

#selectedActionsList .popovermenu {
right: -70px;
top: 25px;
}

#selectedActionLabel {
padding-right: 0px;
}
}

@media only screen and (max-width: 440px) {
#selectedActionsList .popovermenu {
right: -85px;
top: 20px;
}
}
6 changes: 6 additions & 0 deletions apps/files/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
iconClass: 'icon-tag',
order: 100,
},
{
name: 'cancel',
displayName: 'Cancel',
iconClass: 'icon-close',
order: 101,
},
],
sorting: {
mode: $('#defaultFileSorting').val(),
Expand Down
94 changes: 93 additions & 1 deletion apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@

this.$el.on('show', this._onResize);

this.resizeFileActionMenu = _.debounce(_.bind(this.resizeFileActionMenu, this), 250);
$(window).resize(this.resizeFileActionMenu);

// reload files list on share accept
$('body').on('OCA.Notification.Action', function(eventObject) {
if (eventObject.notification.app === 'files_sharing' && eventObject.action.type === 'POST') {
Expand Down Expand Up @@ -558,6 +561,9 @@
case 'tags':
this._onClickTagSelected(ev);
break;
case 'cancel':
this._onClickCancelSelected(ev);
break;
}
},
/**
Expand Down Expand Up @@ -1191,6 +1197,17 @@
});
},

/**
* Event handler for when deselecting all selected files
*/
_onClickCancelSelected: function(ev) {
this._selectedFiles = {};
this._selectionSummary.clear();
$('#filestable input').prop('checked', false);
this.$fileList.find('td.selection > .selectCheckBox:visible').closest('tr').toggleClass('selected', false);
this.updateSelectionSummary();
},

_onClickDocument: function(ev) {
if(!$(ev.target).closest('#editor_container').length) {
this._inputView.setValues([]);
Expand Down Expand Up @@ -1511,6 +1528,12 @@
this.fileMultiSelectMenu.render();
this.$el.find('.selectedActions .filesSelectMenu').remove();
this.$el.find('.selectedActions').append(this.fileMultiSelectMenu.$el);
this.fileMultipleSelectionMenu = new OCA.Files.FileMultipleSelectionMenu(this.multiSelectMenuItems.sort(function(a, b) {
return a.order - b.order
}));
this.fileMultipleSelectionMenu.render();
this.$el.find('.selectedActions .filesSelectionMenu').remove();
this.$el.find('.selectedActions').append(this.fileMultipleSelectionMenu.$el);
},

/**
Expand Down Expand Up @@ -3431,10 +3454,22 @@
this.$el.find('#modified a>span:first').text(t('files','Modified'));
this.$el.find('table').removeClass('multiselect');
this.$el.find('.selectedActions').addClass('hidden');
this.$el.find('#headerSize').removeClass('hidden');
this.$el.find('#headerDate').removeClass('hidden');
this.$el.find('#headerSizeCount').addClass('hidden');
this.$el.find('.headerSizeOpen').addClass('hidden');
$('#selectedActionLabel').css('display','none');
}
else {
this.$el.find('.selectedActions').removeClass('hidden');
this.$el.find('#headerSize a>span:first').text(OC.Util.humanFileSize(summary.totalSize));
this.$el.find('#headerSize').addClass('hidden');
this.$el.find('#headerDate').addClass('hidden');
this.$el.find('#headerSizeCount').removeClass('hidden');
this.$el.find('.headerSizeOpen').removeClass('hidden');
this.$el.find('#selectedActionsList').removeClass('menu-center');
this.$el.find('#headerSizeCount').text(OC.Util.humanFileSize(summary.totalSize));
this.fileMultipleSelectionMenu.show(this);
this.resizeFileActionMenu();

var directoryInfo = n('files', '%n folder', '%n folders', summary.totalDirs);
var fileInfo = n('files', '%n file', '%n files', summary.totalFiles);
Expand Down Expand Up @@ -3477,6 +3512,63 @@
}
},

/**
* Show or hide file action menu based on the current selection
*/
resizeFileActionMenu: function() {
const appList = $('.filesSelectionMenu ul li');
const headerWidth = $('#filestable thead').outerWidth();
const checkWidth = $('#headerSelection').outerWidth();
const headerNameWidth = $('#headerName').outerWidth();
const actionWidth = $('#selectedActionLabel').outerWidth();
const allLabelWidth = $('#allLabel').not('#allLabel:hidden').outerWidth();
var availableWidth;
if(!allLabelWidth){
availableWidth = headerWidth - (checkWidth + headerNameWidth);
}
else{
availableWidth = headerWidth - (checkWidth + allLabelWidth+ headerNameWidth);
}

let appCount = Math.floor((availableWidth / $(appList).width()));

if(appCount < appList.length) {
if(!allLabelWidth){
availableWidth = headerWidth - (checkWidth + headerNameWidth + actionWidth);
}
else{
availableWidth = headerWidth - (checkWidth + allLabelWidth+ headerNameWidth + actionWidth);
}
appCount = Math.floor((availableWidth / $(appList).width()));
}

var summary = this._selectionSummary.summary;
if (summary.totalFiles === 0 && summary.totalDirs === 0) {
$('#selectedActionLabel').css('display','none');
}
else{
if(appCount < appList.length) {
$('#selectedActionLabel').css('display','block');
}
else if(appCount == appList.length){
$('#selectedActionLabel').css('display','none');
}
else if (!isFinite(appCount))
{
$('#selectedActionLabel').css('display','block');
}
}

for (let k = 0; k < appList.length; k++) {
if (k < appCount) {
$(appList[k]).removeClass('hidden');
} else {
$(appList[k]).addClass('hidden');
}
}
},


/**
* Check whether all selected files are copiable
*/
Expand Down
Loading