Improve sort button in drive

pull/1/head
yflory 5 years ago
parent 6e30a7546d
commit 1a54f87b5b

@ -2141,8 +2141,17 @@ define([
var show = function () { var show = function () {
var wh = $(window).height(); var wh = $(window).height();
var topPos = $container[0].getBoundingClientRect().bottom; var button = $button[0].getBoundingClientRect();
$innerblock.css('max-height', Math.floor(wh - topPos - 1)+'px'); var topPos = button.bottom;
$innerblock.css('bottom', '');
if (config.noscroll) {
var h = $innerblock.outerHeight();
if ((topPos + h) > wh) {
$innerblock.css('bottom', button.height+'px');
}
} else {
$innerblock.css('max-height', Math.floor(wh - topPos - 1)+'px');
}
$innerblock.show(); $innerblock.show();
$innerblock.find('.cp-dropdown-element-active').removeClass('cp-dropdown-element-active'); $innerblock.find('.cp-dropdown-element-active').removeClass('cp-dropdown-element-active');
if (config.isSelect && value) { if (config.isSelect && value) {

@ -2748,21 +2748,22 @@ define([
var options = [{ var options = [{
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-element-type'}, attributes: {'class': 'cp-app-drive-element-type'},
content: Messages.fm_type content: '<i class="fa fa-minus"></i>' + Messages.fm_type
},{ },{
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-element-atime'}, attributes: {'class': 'cp-app-drive-element-atime'},
content: Messages.fm_lastAccess content: '<i class="fa fa-minus"></i>' + Messages.fm_lastAccess
},{ },{
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-element-ctime'}, attributes: {'class': 'cp-app-drive-element-ctime'},
content: Messages.fm_creation content: '<i class="fa fa-minus"></i>' + Messages.fm_creation
}]; }];
var dropdownConfig = { var dropdownConfig = {
text: '', // Button initial text text: '', // Button initial text
options: options, // Entries displayed in the menu options: options, // Entries displayed in the menu
container: $fhSort, container: $fhSort,
left: true, left: true,
noscroll: true,
common: common common: common
}; };
var $sortBlock = UIElements.createDropdown(dropdownConfig); var $sortBlock = UIElements.createDropdown(dropdownConfig);
@ -2805,7 +2806,7 @@ define([
if (APP.store[SORT_FILE_BY] === '') { classSorted = 'cp-app-drive-sort-filename'; } if (APP.store[SORT_FILE_BY] === '') { classSorted = 'cp-app-drive-sort-filename'; }
else if (APP.store[SORT_FILE_BY]) { classSorted = 'cp-app-drive-element-' + APP.store[SORT_FILE_BY]; } else if (APP.store[SORT_FILE_BY]) { classSorted = 'cp-app-drive-element-' + APP.store[SORT_FILE_BY]; }
if (classSorted) { if (classSorted) {
$list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon); $list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon).find('i').hide();
} }
}; };
var getFileListHeader = function (clickable) { var getFileListHeader = function (clickable) {

Loading…
Cancel
Save