From 76c226c57ba639e2852f46911176cc7eede605aa Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Sat, 16 May 2015 14:28:54 +0200 Subject: [PATCH] Add ignorecase option to tree. --- CHANGELOG.md | 1 + src/_h5ai/conf/options.json | 4 +++- src/_h5ai/public/js/inc/ext/tree.js | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 089514c4..bc04dab0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * adds search * adds wide links in tree view * adds IE edge mode +* adds ignorecase sorting option to tree * fixes some styles in IE10 * fixes preview bottom bar for small screen widths * changes API diff --git a/src/_h5ai/conf/options.json b/src/_h5ai/conf/options.json index 4c1d7902..42e7f5c2 100644 --- a/src/_h5ai/conf/options.json +++ b/src/_h5ai/conf/options.json @@ -388,11 +388,13 @@ Options - show: boolean, initial visible to first time users - maxSubfolders: number, max number of subfolders to show in tree - naturalSort: boolean, use natural sort order for folders + - ignorecase: boolean, sort ignorecase */ "tree": { "enabled": true, "show": true, "maxSubfolders": 50, - "naturalSort": false + "naturalSort": false, + "ignorecase": true } } diff --git a/src/_h5ai/public/js/inc/ext/tree.js b/src/_h5ai/public/js/inc/ext/tree.js index 918cc008..f3c6a08c 100644 --- a/src/_h5ai/public/js/inc/ext/tree.js +++ b/src/_h5ai/public/js/inc/ext/tree.js @@ -4,7 +4,8 @@ modulejs.define('ext/tree', ['_', '$', 'core/event', 'core/location', 'core/reso enabled: false, show: true, maxSubfolders: 50, - naturalSort: false + naturalSort: false, + ignorecase: true }, allsettings.tree); var template = '
' + @@ -31,6 +32,11 @@ modulejs.define('ext/tree', ['_', '$', 'core/event', 'core/location', 'core/reso var val1 = item1.label; var val2 = item2.label; + if (settings.ignorecase) { + val1 = val1.toLowerCase(); + val2 = val2.toLowerCase(); + } + return settings.natural ? util.naturalCmpFn(val1, val2) : util.regularCmpFn(val1, val2); }