Changeset 28938
- Timestamp:
- Jul 4, 2014, 12:30:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/js/LocalStorageCache.js
r28937 r28938 203 203 options.loader = function(callback) { 204 204 $.getJSON(options.rootUrl + 'ws.php?format=json&method=pwg.categories.getAdminList', function(data) { 205 callback(data.result.categories); 205 var cats = data.result.categories.map(function(c, i) { 206 c.pos = i; 207 delete c['comment']; 208 delete c['uppercats']; 209 return c; 210 }); 211 212 callback(cats); 206 213 }); 207 214 }; … … 218 225 CategoriesCache.prototype.selectize = function($target, options) { 219 226 options = options || {}; 220 221 options.filter = function(cats) {222 cats.map(function(c) {223 c.pos = c.global_rank.split('.');224 });225 226 cats.sort(function(a, b) {227 var i = 0;228 while (a.pos[i] && b.pos[i]) {229 if (a.pos[i] != b.pos[i]) {230 return a.pos[i] - b.pos[i];231 }232 i++;233 }234 return (!a.pos[i] && b.pos[i]) ? -1 : 1;235 });236 237 cats.map(function(c, i) {238 c.pos = i;239 });240 241 return cats;242 };243 227 244 228 $target.selectize({ … … 268 252 options.loader = function(callback) { 269 253 $.getJSON(options.rootUrl + 'ws.php?format=json&method=pwg.tags.getAdminList', function(data) { 270 var tags = data.result.tags; 271 272 for (var i=0, l=tags.length; i<l; i++) { 273 tags[i].id = '~~' + tags[i].id + '~~'; 274 } 275 254 var tags = data.result.tags.map(function(t) { 255 t.id = '~~' + t.id + '~~'; 256 delete t['url_name']; 257 delete t['lastmodified']; 258 return t; 259 }); 260 276 261 callback(tags); 277 262 }); … … 316 301 options.loader = function(callback) { 317 302 $.getJSON(options.rootUrl + 'ws.php?format=json&method=pwg.groups.getList&per_page=9999', function(data) { 318 callback(data.result.groups); 303 var groups = data.result.groups.map(function(g) { 304 delete g['lastmodified']; 305 return g; 306 }); 307 308 callback(groups); 319 309 }); 320 310 };
Note: See TracChangeset
for help on using the changeset viewer.