From 1b60bafb587b68b2aaab4d634a62687d12a0f8c8 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Mon, 26 May 2014 16:56:39 +0000 Subject: feature 3077 : always sort categories by global rank git-svn-id: http://piwigo.org/svn/trunk@28540 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/themes/default/template/cat_modify.tpl | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'admin/themes/default/template/cat_modify.tpl') diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl index 4010aec38..4bb06c03b 100644 --- a/admin/themes/default/template/cat_modify.tpl +++ b/admin/themes/default/template/cat_modify.tpl @@ -20,7 +20,7 @@ var categoriesCache = new LocalStorageCache({ jQuery('[data-selectize=categories]').selectize({ valueField: 'id', labelField: 'fullname', - sortField: 'fullname', + sortField: 'global_rank', searchField: ['fullname'], plugins: ['remove_button'] }); @@ -28,7 +28,8 @@ jQuery('[data-selectize=categories]').selectize({ categoriesCache.get(function(categories) { categories.push({ id: 0, - fullname: '------------' + fullname: '------------', + global_rank: 0 }); // remove itself and children @@ -36,10 +37,6 @@ categoriesCache.get(function(categories) { return !(/\b{$CAT_ID}\b/.test(cat.uppercats)); }); - categories.sort(function(a, b) { - return a.fullname.localeCompare(b.fullname); - }); - jQuery('[data-selectize=categories]').each(function() { this.selectize.load(function(callback) { callback(categories); @@ -51,11 +48,11 @@ categoriesCache.get(function(categories) { // prevent empty value if (this.selectize.getValue() == '') { - this.selectize.setValue(categories[0].id); + this.selectize.setValue(0); } this.selectize.on('dropdown_close', function() { if (this.getValue() == '') { - this.setValue(categories[0].id); + this.setValue(0); } }); }); -- cgit v1.2.3