diff options
author | mistic100 <mistic@piwigo.org> | 2014-07-04 10:30:26 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-07-04 10:30:26 +0000 |
commit | a9d6e70d38d88f40dd793c83c2299b8d5a08f939 (patch) | |
tree | fd99e8357d76bda97df1896daeb56c2dd5ce4df9 /admin/themes/default/js/LocalStorageCache.js | |
parent | 314cd45f7557a211a53227af43f87c3988a58c28 (diff) |
selectize/localcache : remove overkill categories sorting (already done in WS) + remove some data (comments, uppercets, etc...)
git-svn-id: http://piwigo.org/svn/trunk@28938 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/themes/default/js/LocalStorageCache.js')
-rw-r--r-- | admin/themes/default/js/LocalStorageCache.js | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/admin/themes/default/js/LocalStorageCache.js b/admin/themes/default/js/LocalStorageCache.js index 1733ed85d..4fb1d2860 100644 --- a/admin/themes/default/js/LocalStorageCache.js +++ b/admin/themes/default/js/LocalStorageCache.js @@ -202,7 +202,14 @@ options.loader = function(callback) { $.getJSON(options.rootUrl + 'ws.php?format=json&method=pwg.categories.getAdminList', function(data) { - callback(data.result.categories); + var cats = data.result.categories.map(function(c, i) { + c.pos = i; + delete c['comment']; + delete c['uppercats']; + return c; + }); + + callback(cats); }); }; @@ -218,29 +225,6 @@ CategoriesCache.prototype.selectize = function($target, options) { options = options || {}; - options.filter = function(cats) { - cats.map(function(c) { - c.pos = c.global_rank.split('.'); - }); - - cats.sort(function(a, b) { - var i = 0; - while (a.pos[i] && b.pos[i]) { - if (a.pos[i] != b.pos[i]) { - return a.pos[i] - b.pos[i]; - } - i++; - } - return (!a.pos[i] && b.pos[i]) ? -1 : 1; - }); - - cats.map(function(c, i) { - c.pos = i; - }); - - return cats; - }; - $target.selectize({ valueField: 'id', labelField: 'fullname', @@ -267,12 +251,13 @@ options.loader = function(callback) { $.getJSON(options.rootUrl + 'ws.php?format=json&method=pwg.tags.getAdminList', function(data) { - var tags = data.result.tags; - - for (var i=0, l=tags.length; i<l; i++) { - tags[i].id = '~~' + tags[i].id + '~~'; - } - + var tags = data.result.tags.map(function(t) { + t.id = '~~' + t.id + '~~'; + delete t['url_name']; + delete t['lastmodified']; + return t; + }); + callback(tags); }); }; @@ -315,7 +300,12 @@ options.loader = function(callback) { $.getJSON(options.rootUrl + 'ws.php?format=json&method=pwg.groups.getList&per_page=9999', function(data) { - callback(data.result.groups); + var groups = data.result.groups.map(function(g) { + delete g['lastmodified']; + return g; + }); + + callback(groups); }); }; |