Skip to content

Commit 6ae8e99

Browse files
authored
Merge pull request #13982 from nextcloud/stable15-12917-clean-code-and-fix-drop-zone-shadow
[stable15] Clean code and fix drop zone shadow
2 parents 7fc115d + 150d15b commit 6ae8e99

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

apps/files/css/files.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ table.dragshadow td.size {
699699
background-image: none;
700700
}
701701
& .icon-starred {
702-
@include icon-color('star-dark', 'actions', 'FC0', 1, true);
702+
@include icon-color('star-dark', 'actions', $color-yellow, 1, true);
703703
}
704704
}
705705

@@ -722,7 +722,13 @@ table.dragshadow td.size {
722722

723723
.breadcrumb .canDrop > a,
724724
#filestable tbody tr.canDrop {
725-
background-color: rgb(179, 230, 255);
725+
background-color: rgba( $color-primary, .3 );
726+
}
727+
.dropzone-background {
728+
background-color: rgba( $color-primary, .3 );
729+
:hover{
730+
box-shadow: none !important;
731+
}
726732
}
727733

728734

apps/files/js/filelist.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,8 @@
354354

355355
this.$fileList.on('click','td.filename>a.name, td.filesize, td.date', _.bind(this._onClickFile, this));
356356

357-
$.event.trigger({type: "droppedOnTrash"});
358-
359-
var self=this;
360-
this.$fileList.on("droppedOnTrash", function (event, filename, directory) {
361-
//self.fileActions.triggerAction('Favorite', self.getModelForFile(file), self);
362-
self.do_delete(filename, directory)
357+
this.$fileList.on('droppedOnTrash', function (event, filename, directory) {
358+
self.do_delete(filename, directory);
363359
});
364360

365361
this.$fileList.on('change', 'td.selection>.selectCheckBox', _.bind(this._onClickFileCheckbox, this));

apps/files/js/navigation.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,40 +62,37 @@
6262
* Setup UI events
6363
*/
6464
_setupEvents: function () {
65-
this.$el.on('click', 'li a', _.bind(this._onClickItem, this))
65+
this.$el.on('click', 'li a', _.bind(this._onClickItem, this));
6666
this.$el.on('click', 'li button', _.bind(this._onClickMenuButton, this));
6767

68-
var trashElement=$(".nav-trashbin");
69-
70-
//this div is required to prefetch the icon, otherwise it takes a second to show up
71-
trashElement.append("<div class='nav-icon-trashbin-starred'></div>")
72-
trashElement.droppable({
73-
over: function( event, ui ) {
74-
trashElement.addClass('dropzone-background')
68+
var trashBinElement = $('.nav-trashbin');
69+
trashBinElement.droppable({
70+
over: function (event, ui) {
71+
trashBinElement.addClass('dropzone-background');
7572
},
76-
out: function( event, ui ) {
77-
trashElement.removeClass('dropzone-background');
73+
out: function (event, ui) {
74+
trashBinElement.removeClass('dropzone-background');
7875
},
79-
activate: function( event, ui ) {
80-
var elem=trashElement.find("a").first();
81-
elem.addClass('nav-icon-trashbin-starred').removeClass('nav-icon-trashbin');
76+
activate: function (event, ui) {
77+
var element = trashBinElement.find('a').first();
78+
element.addClass('nav-icon-trashbin-starred').removeClass('nav-icon-trashbin');
8279
},
83-
deactivate: function( event, ui ) {
84-
var elem=trashElement.find("a").first();
85-
elem.addClass('nav-icon-trashbin').removeClass('nav-icon-trashbin-starred');
80+
deactivate: function (event, ui) {
81+
var element = trashBinElement.find('a').first();
82+
element.addClass('nav-icon-trashbin').removeClass('nav-icon-trashbin-starred');
8683
},
87-
drop: function( event, ui ) {
84+
drop: function (event, ui) {
85+
trashBinElement.removeClass('dropzone-background');
8886

8987
var $selectedFiles = $(ui.draggable);
9088

91-
if (ui.helper.find("tr").size()===1) {
92-
var $tr = $selectedFiles.closest('tr');
93-
$selectedFiles.trigger("droppedOnTrash", $tr.attr("data-file"), $tr.attr('data-dir'));
94-
}else{
95-
var item = ui.helper.find("tr");
96-
for(var i=0; i<item.length;i++){
97-
$selectedFiles.trigger("droppedOnTrash", item[i].getAttribute("data-file"), item[i].getAttribute("data-dir"));
98-
}
89+
// FIXME: when there are a lot of selected files the helper
90+
// contains only a subset of them; the list of selected
91+
// files should be gotten from the file list instead to
92+
// ensure that all of them are removed.
93+
var item = ui.helper.find('tr');
94+
for (var i = 0; i < item.length; i++) {
95+
$selectedFiles.trigger('droppedOnTrash', item[i].getAttribute('data-file'), item[i].getAttribute('data-dir'));
9996
}
10097
}
10198
});
@@ -222,7 +219,7 @@
222219
*/
223220
setInitialQuickaccessSettings: function () {
224221
var quickAccessKey = this.$quickAccessListKey;
225-
var quickAccessMenu = document.getElementById(quickAccessKey)
222+
var quickAccessMenu = document.getElementById(quickAccessKey);
226223
if (quickAccessMenu) {
227224
var list = quickAccessMenu.getElementsByTagName('li');
228225
this.QuickSort(list, 0, list.length - 1);

core/css/icons.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,13 @@ img, object, video, button, textarea, input, select, div[contenteditable='true']
282282
&:focus {
283283
@include icon-color('star', 'actions', $color-black, 1, true);
284284
}
285-
@include icon-color('star-dark', 'actions', 'FC0', 1, true);
285+
@include icon-color('star-dark', 'actions', $color-yellow, 1, true);
286286
}
287287

288288
.icon-star {
289289
&:hover,
290290
&:focus {
291-
@include icon-color('star-dark', 'actions', 'FC0', 1, true);
291+
@include icon-color('star-dark', 'actions', $color-yellow, 1, true);
292292
}
293293
}
294294

core/css/variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ $color-success: #46ba61;
5353
// used for svg
5454
$color-white: #fff;
5555
$color-black: #000;
56+
$color-yellow: #FC0;
5657

5758
// rgb(118, 118, 118) / #767676
5859
// min. color contrast for normal text on white background according to WCAG AA

0 commit comments

Comments
 (0)