Skip to content

Commit

Permalink
[cmd:sort] fix Studio-42#2774 to make can disable "Also Treeview" sor…
Browse files Browse the repository at this point in the history
…t option
  • Loading branch information
nao-pon committed Nov 27, 2018
1 parent 12450d3 commit 2f8c345
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion js/commands/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ elFinder.prototype.commands.sort = function() {
'stick',
(fm.sortStickFolders? '<span class="ui-icon ui-icon-check"/>' : '') + '&nbsp;' + fm.i18n('sortFoldersFirst')
]);
if (fm.ui.tree) {
if (fm.ui.tree && fm.options.sortAlsoTreeview !== null) {
self.variants.push('|');
self.variants.push([
'tree',
Expand Down
2 changes: 1 addition & 1 deletion js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ var elFinder = function(elm, opts, bootCallback) {
}

this.sortAlsoTreeview = this.storage('sortAlsoTreeview');
if (this.sortAlsoTreeview === null) {
if (this.sortAlsoTreeview === null || this.options.sortAlsoTreeview === null) {
this.sortAlsoTreeview = !!this.options.sortAlsoTreeview;
} else {
this.sortAlsoTreeview = !!this.sortAlsoTreeview;
Expand Down
4 changes: 2 additions & 2 deletions js/elFinder.options.js
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,9 @@ elFinder.prototype._options = {
sortStickFolders : true,

/**
* Sort also applies to the treeview
* Sort also applies to the treeview (null: disable this feature)
*
* @type {Boolean}
* @type Boolean|null
* @default false
*/
sortAlsoTreeview : false,
Expand Down
16 changes: 8 additions & 8 deletions js/ui/sortbutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ $.fn.elfindersortbutton = function(cmd) {
cmd.exec([], 'stick');
});

if ($.fn.elfindertree && $.inArray('tree', fm.options.ui) !== -1) {
$('<div class="'+item+' '+item+'-separated elfinder-sort-ext elfinder-sort-tree"><span class="ui-icon ui-icon-check"/>'+fm.i18n('sortAlsoTreeview')+'</div>')
fm.one('init', function() {
if (fm.ui.tree && fm.options.sortAlsoTreeview !== null) {
$('<div class="'+item+' '+item+'-separated elfinder-sort-ext elfinder-sort-tree"><span class="ui-icon ui-icon-check"/>'+fm.i18n('sortAlsoTreeview')+'</div>')
.appendTo(menu)
.on('click', function() {
cmd.exec([], 'tree');
});
}

fm.bind('disable select', hide).getUI().on('click', hide);

fm.bind('open', function() {
}
})
.bind('disable select', hide)
.bind('open', function() {
menu.children('[rel]').each(function() {
var $this = $(this);
$this.toggle(fm.sorters[$this.attr('rel')]);
});
}).bind('sortchange', update);
}).bind('sortchange', update).getUI().on('click', hide);

if (menu.children().length > 1) {
cmd.change(function() {
Expand Down

0 comments on commit 2f8c345

Please sign in to comment.